• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF drop down problems again  RSS feed

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

I have been reading a lot about drop-down boxes in JSF. Most of them have been very useful but have not been able to completely solve my problem here...

I have a very simple page that displays a dropdown with model-id numbers. There is also a button below the dropdown which when clicked takes the user to another page and says "You selected this model: <model-id number from dropdown>"

So far so good - all works fine. Now I wanted to add a description so that after clicking on the button I get the modelId as well as the model description - This just does not work - the page does not even come up and shows a lot of errors.

In order to show the description as well I used the SelectItem constructor that accepts a value and a label. I used the modelId as the label and the model-description as value.

Here is the jsp page code:

Here is the java backing bean code:
This code is supposed to put the modelDescription as well - but does not work....

I get these errors:
On the browser:

javax.faces.el.EvaluationException: Expression: '#{modelBean.models}'
at net.sourceforge.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:463)
at javax.faces.component.UISelectItems.getValue(UISelectItems.java:55)
at net.sourceforge.myfaces.renderkit.RendererUtils.internalGetSelectItemList(RendererUtils.java:357)
at net.sourceforge.myfaces.renderkit.RendererUtils.getSelectItemList(RendererUtils.java:300)
at net.sourceforge.myfaces.renderkit.html.HtmlRendererUtils.internalRenderSelect(HtmlRendererUtils.java:369)
at net.sourceforge.myfaces.renderkit.html.HtmlRendererUtils.renderMenu(HtmlRendererUtils.java:328)
at net.sourceforge.myfaces.renderkit.html.HtmlMenuRendererBase.encodeEnd(HtmlMenuRendererBase.java:64)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:329)
at javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:376)
at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:280)
at org.apache.jsp.gse.model_jsp._jspx_meth_h_selectOneMenu_0(org.apache.jsp.gse.model_jsp:306)
at org.apache.jsp.gse.model_jsp._jspx_meth_h_form_0(org.apache.jsp.gse.model_jsp:183)
at org.apache.jsp.gse.model_jsp._jspx_meth_f_view_0(org.apache.jsp.gse.model_jsp:147)
at org.apache.jsp.gse.model_jsp._jspService(org.apache.jsp.gse.model_jsp:92)
Caused by: javax.faces.el.EvaluationException: Bean: com.sigma.gse.view.ModelPageBean, property: models
at net.sourceforge.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:458)
at net.sourceforge.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:113)
at net.sourceforge.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java:541)
at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
at net.sourceforge.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:438)
... 56 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.sourceforge.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:454)
... 60 more
Caused by: java.lang.NullPointerException: value
at javax.faces.model.SelectItem.(SelectItem.java:55)
at com.sigma.gse.view.ModelPageBean.getModels(ModelPageBean.java:48)
... 65 more

On the Tomcat console:
ERROR - PropertyResolverImpl.getValue(117) | com.sigma.gse.view.ModelPageBean
javax.faces.el.EvaluationException: Bean: com.sigma.gse.view.ModelPageBean, property: models
at net.sourceforge.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:4
at net.sourceforge.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:113)
at net.sourceforge.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java

Code that worked:

I need help in figuring out what I am doing wrong? If you notice, there is very little difference between the code that worked and the above defective code.

Thanks a TON in advance,
Anoop V. Kumar
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok - I figured out the answer to this issue of mine - I need to use converters because I am using application specific objects..

Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!