Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

ERROR - ValueBindingImpl.getValue | Cannot get value for expression '#{modelPage  RSS feed

 
Anoop V. Kumar
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am a newbie to JSF.

I have a problem when I am trying to display the results of a select query using JSF. I am using Spring with Hibernate with JSF for the display of the jsp page.

I get this error:

ERROR - ValueBindingImpl.getValue(454) | Cannot get value for expression '#{modelPageBean.modelIds.model}'
javax.faces.el.PropertyNotFoundException: Bean: com.gse.view.ModelPageBean, property: modelIds

I have been trying every combination for the past 3-4 days and am quite at the end of my wits....

Here is my faces-config.xml:
****************************************
<managed-bean>
<managed-bean-name>serviceLocator</managed-bean-name>
<managed-bean-class>com.gse.service.ServiceLocatorImpl</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
</managed-bean>

<managed-bean>
<managed-bean-name>modelPageBean</managed-bean-name>
<managed-bean-class>com.gse.view.ModelPageBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>modelIds</property-name>
<value>#{param.modelIds}</value>
</managed-property>
<managed-property>
<property-name>serviceLocator</property-name>
<value>#{serviceLocator}</value>
</managed-property>
</managed-bean>
****************************************

Here is my jsp:
****************************************
<%@ page language="java" errorPage="/error.jsp" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<html>
<head><title>Select a Model to proceed</title></head>
<!--f:loadBundle basename="messages.properties" var="bundle"/-->

<body bgcolor="#EDF0F5">
<f:view>
<h anelGrid columns="1" summary="Models"
title="MODELS"/>
<h:selectOneMenu value="#{modelPageBean.modelIds}">
<f:selectItems value="#{modelPageBean.modelIds.model}"/>
</h:selectOneMenu>
</f:view>
</body>
</html>
****************************************

And here is the implementation of my ModelPageBean.java:
****************************************
public class ModelPageBean {
private ServiceLocator serviceLocator;
private List<Model> modelIds;
List<Model> models;

private Log logger = LogFactory.getLog(this.getClass());

public ModelPageBean(){
this.logger.debug("ModelPageBean constructed");
}

public ServiceLocator getServiceLocator(){
return this.serviceLocator;
}

public void setServiceLocator(ServiceLocator serviceLocator){
logger.info("Inside setSericeLocator method");
this.serviceLocator = serviceLocator;
this.init();
}

private void init() {
try {
this.setModelIds();
this.logger.info(new StringBuffer().append("Inside init: Got Models: ").append(this.modelIds).toString());
} catch (Exception exception) {
logger.error(new StringBuilder().append("Models not initialized: ").append(exception.getMessage()).toString());
}
}

public void setModelIds(){
this.modelIds = this.getServiceLocator().getModelService().getModels();
this.logger.info("Setting ModelIds");
}

public List<Model> getModelIds(){
for(Model model : this.modelIds){
models.add((Model) new SelectItem(model));
}
logger.info("Models ready for display");
return this.models;
}
}
****************************************

I also have a ModelImpl.java class which implements a Model interface. This class retrieves the ModelId from the database...

All the jsp does is to get the modelIds and show them in a dropdown...

I have the ModelPageBean as a managed-bean of name modelPageBean which contains a getModelIds which returns a list of Models.

I need a bit of help please to understand where I am going wrong...

TIA,
Anoop
 
Anoop V. Kumar
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually this is the complete error that I get:

DEBUG - ModelPageBean.<init>(25) | ModelPageBean constructed
ERROR - PropertyResolverImpl.setValue(202) | com.sikorsky.gse.view.ModelPageBean
javax.faces.el.PropertyNotFoundException: Bean: com.gse.view.ModelPageBean, property: modelIds
at net.sourceforge.myfaces.el.PropertyResolverImpl.setProperty(PropertyResolverImpl.java:407)
at net.sourceforge.myfaces.el.PropertyResolverImpl.setValue(PropertyResolverImpl.java:198)
at net.sourceforge.myfaces.config.ManagedBeanBuilder.initializeProperties(ManagedBeanBuilder.java:133)
at net.sourceforge.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:56)


So the ModelPageBean is being created - but probably my value for the managed-bean property is incorrect.

-Anoop
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!