"Cannot get value for expression" error
nusa Nov 1, 2005 10:03 AMHi,
I have the following jsp page :
<h:dataTable value="#{projectUpdate.findAll}" var="row" rows="10" binding="#{dataAction.table}" > <h:column> <f:facet name="header"> <h:outputText value="ProjectID" /> </f:facet> <h:outputText value="#{row.projectId}" /> </h:column> <h:column> <f:facet name="header"> <h:outputText value="ProjectName" /> </f:facet> <h:inputText value="#{row.projectName}" /> </h:column> <h:column> <f:facet name="header"> <h:outputText value="Descriptions" /> </f:facet> <h:inputText value="#{row.descriptions}" /> </h:column> <h:column> <f:facet name="header"> <h:outputText value="SelectItem" /> </f:facet> <h:commandButton value="Update" action="#{projectUpdate.markForEdition}" /> </h:column> </h:dataTable>
and these 2 beans :
@Name("dataAction") @Scope(EVENT) public class DataAction { private static Logger log = Logger.getLogger(DataAction.class); private UIData table; public UIData getTable() { return table; } public void setTable(UIData table) { this.table = table; } }
@Intercept(InterceptionType.ALWAYS) @Name("projectUpdate") public class ProjectUpdate implements Serializable { private static Logger log = Logger.getLogger(ProjectUpdate.class); @In @Out private Project project; private List<Project> listProject; @In(create=true) private Session hibernateSession; public ProjectUpdate() { log.info("=== Constructor ..."); } public List<Project> getFindAll() { log.info("=== getFindAll ... "); if (listProject == null) buildListProject(); return listProject; } public void setFindAll(List<Project> prj) { this.listProject = prj; } @SuppressWarnings("unchecked") public void buildListProject() { log.info("=== buildListProject ... "); List<Project> list = null; try { list = hibernateSession.createCriteria(Project.class) .addOrder(Order.asc("projectName")) .list(); log.info("=== buildListProject has : " + list.size()); } catch (HibernateException ex) { log.info("HibernateException raised : " + ex.toString()); } setFindAll(list); } @IfInvalid(outcome=REDISPLAY) public String markForEdition() { log.info("=== markForEdition ..."); log.info("=== get dataAction ..."); DataAction data = (DataAction)Contexts.getEventContext().get("dataAction"); UIData table = data.getTable(); if ( table.isRowAvailable() ) { project = (Project) table.getRowData(); log.info("=== Attempting to update a row : " + project.toString()); hibernateSession.saveOrUpdate(project); return "success"; } else { log.info("=== Couldn't find row !!!"); } return null; } }
When that JSP page get rendered, the list of projects is displayed properly :
14:53:03,192 INFO [example.action.ProjectUpdate] === Constructor ... 14:53:03,192 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: projectUpdate.component 14:53:03,192 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolved name to seam component 14:53:03,202 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: projectUpdate.component 14:53:03,202 DEBUG [org.jboss.seam.contexts.Contexts] found in event context: org.jboss.seam.core.manager 14:53:03,202 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: org.jboss.seam.core.manager.component 14:53:03,202 DEBUG [org.jboss.seam.contexts.Contexts] found in event context: org.jboss.seam.core.manager 14:53:03,202 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: org.jboss.seam.core.manager.component 14:53:03,202 DEBUG [org.jboss.seam.contexts.Contexts] found in event context: project 14:53:03,202 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: project.component 14:53:03,202 DEBUG [org.jboss.seam.contexts.Contexts] found in conversation context: hibernateSession 14:53:03,202 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: hibernateSession.component 14:53:03,202 INFO [example.action.ProjectUpdate] === getFindAll ... 14:53:03,202 INFO [example.action.ProjectUpdate] === buildListProject ... 14:53:03,232 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0) 14:53:03,232 DEBUG [org.hibernate.jdbc.ConnectionManager] opening JDBC connection 14:53:03,232 DEBUG [org.hibernate.jdbc.JDBCContext] successfully registered Synchronization 14:53:03,232 DEBUG [org.hibernate.SQL] select this_.projectId as projectId0_0_, this_.version as version0_0_, this_.descriptions as descript3_0_0_, this_.projectName as projectN4_0_0_ from Project this_ order by this_.projectName asc 14:53:03,232 INFO [STDOUT] Hibernate: select this_.projectId as projectId0_0_, this_.version as version0_0_, this_.descriptions as descript3_0_0_, this_.projectName as projectN4_0_0_ from Project this_ order by this_.projectName asc 14:53:03,232 DEBUG [org.hibernate.jdbc.AbstractBatcher] preparing statement 14:53:03,232 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to open ResultSet (open ResultSets: 0, globally: 0) 14:53:03,242 DEBUG [org.hibernate.loader.Loader] processing result set
But when I click on the 'Update' button, I got the following error :
14:56:45,112 DEBUG [org.jboss.seam.contexts.Lifecycle] >>> Begin web request 14:56:45,112 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: org.jboss.seam.core.manager.component 14:56:45,112 DEBUG [org.jboss.seam.Component] instantiating Seam component: org.jboss.seam.core.manager 14:56:45,112 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: org.jboss.seam.core.manager.component 14:56:45,153 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolving name: dataAction 14:56:45,153 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: dataAction.component 14:56:45,153 DEBUG [org.jboss.seam.Component] instantiating Seam component: dataAction 14:56:45,153 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: dataAction.component 14:56:45,153 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolved name to seam component 14:56:45,153 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolving name: dataAction 14:56:45,153 DEBUG [org.jboss.seam.contexts.Contexts] found in event context: dataAction 14:56:45,153 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: dataAction.component 14:56:45,153 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolved name to seam component 14:56:45,153 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: dataAction.component 14:56:45,153 DEBUG [org.jboss.seam.contexts.Contexts] found in event context: org.jboss.seam.core.manager 14:56:45,153 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: org.jboss.seam.core.manager.component 14:56:45,153 DEBUG [org.jboss.seam.contexts.Contexts] found in event context: org.jboss.seam.core.manager 14:56:45,153 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: org.jboss.seam.core.manager.component 14:56:45,153 DEBUG [org.jboss.seam.core.Manager] No stored conversation 14:56:45,153 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: org.jboss.seam.core.init 14:56:45,153 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: org.jboss.seam.core.init.component 14:56:45,153 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] After restore view, conversation context: ConversationContext(3) 14:56:45,153 DEBUG [org.jboss.seam.contexts.BusinessProcessContext] Created BusinessProcessContext 14:56:45,153 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolving name: projectUpdate 14:56:45,153 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: projectUpdate.component 14:56:45,153 DEBUG [org.jboss.seam.Component] instantiating Seam component: projectUpdate 14:56:45,153 INFO [example.action.ProjectUpdate] === Constructor ... 14:56:45,153 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: projectUpdate.component 14:56:45,153 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolved name to seam component 14:56:45,153 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: projectUpdate.component 14:56:45,153 DEBUG [org.jboss.seam.contexts.Contexts] found in event context: org.jboss.seam.core.manager 14:56:45,153 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: org.jboss.seam.core.manager.component 14:56:45,153 DEBUG [org.jboss.seam.contexts.Contexts] found in event context: org.jboss.seam.core.manager 14:56:45,153 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: org.jboss.seam.core.manager.component 14:56:45,153 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: projectUpdate.component 14:56:45,153 DEBUG [org.jboss.seam.contexts.Contexts] found in event context: org.jboss.seam.core.manager 14:56:45,153 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: org.jboss.seam.core.manager.component 14:56:45,153 DEBUG [org.jboss.seam.contexts.Contexts] found in event context: org.jboss.seam.core.manager 14:56:45,153 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: org.jboss.seam.core.manager.component 14:56:45,153 ERROR [org.jboss.seam.servlet.SeamExceptionFilter] uncaught exception handled by Seam: Cannot get value for expression '#{projectUpdate.findAll}' 14:56:45,163 DEBUG [org.jboss.seam.contexts.Lifecycle] After render response, destroying contexts 14:56:45,163 DEBUG [org.jboss.seam.contexts.Lifecycle] flushing busines process context 14:56:45,163 DEBUG [org.jboss.seam.contexts.BusinessProcessContext] no in-memory state to flush to jBPM context 14:56:45,163 DEBUG [org.jboss.seam.contexts.BusinessProcessContext] no jBPM context to which to flush 14:56:45,163 DEBUG [org.jboss.seam.contexts.Lifecycle] destroying event context 14:56:45,163 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: org.jboss.seam.core.manager.component 14:56:45,163 DEBUG [org.jboss.seam.contexts.Contexts] destroying: org.jboss.seam.core.manager 14:56:45,163 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: dataAction.component 14:56:45,163 DEBUG [org.jboss.seam.contexts.Contexts] destroying: dataAction 14:56:45,163 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: projectUpdate.component 14:56:45,163 DEBUG [org.jboss.seam.contexts.Contexts] destroying: projectUpdate 14:56:45,163 DEBUG [org.jboss.seam.contexts.Contexts] found in event context: org.jboss.seam.core.manager 14:56:45,163 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: org.jboss.seam.core.manager.component 14:56:45,163 DEBUG [org.jboss.seam.contexts.Lifecycle] destroying conversation context 14:56:45,163 DEBUG [org.jboss.seam.contexts.Lifecycle] flushing server-side conversation context 14:56:45,163 DEBUG [org.jboss.seam.contexts.Contexts] found in event context: org.jboss.seam.core.manager 14:56:45,163 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: org.jboss.seam.core.manager.component 14:56:45,163 DEBUG [org.jboss.seam.contexts.Lifecycle] <<< End web request 14:56:45,163 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/SeamTest].[faces]] Servlet.service() for servlet faces threw exception javax.faces.el.EvaluationException: Cannot get value for expression '#{projectUpdate.findAll}' at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:399) at javax.faces.component.UIData.getValue(UIData.java:779) at javax.faces.component.UIData.createDataModel(UIData.java:545) at javax.faces.component.UIData.getDataModel(UIData.java:534) ...
Can someone help me where that error coming from ?
Thanks.