• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Bean Value is always Null

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,

I am new to JSF and am having an issue with a selectonemenu component always being null. I have form that is is populated with backing bean list that has the states. On the form the list displays properly. However when I attempt to write the value to the database, I get a null value.


Backing bean with list:



jsp view page:


selectedState method:
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Omar,
it seems that states_ isn't null, maybe you instatiated it and it is empty? Check for (states_!= && states_.size() < 1)
 
Omar Barrera
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What I noticed in my code is that I initialized state_ to null. So I corrected that and am now getting another error. The error I am getting is Caused by: java.lang.NoSuchMethodError:

Here is a copy of the class I am using:

When I am calling the getSelectedState method from the bean I am getting
Caused by: java.lang.NoSuchMethodError: stateBean.getState()Ljava/lang/String;




Caused by: javax.faces.FacesException: Error calling action method of component with id _idJsp0Pluto_264_:SaveButton
at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72)
at javax.faces.component.UICommand.broadcast(UICommand.java:109)
at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:97)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:171)
at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32)
at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
at org.apache.myfaces.portlet.MyFacesGenericPortlet.processAction(MyFacesGenericPortlet.java:246)
... 38 more
Caused by: javax.faces.el.EvaluationException: Exception while invoking expression #{databaseHandler.InsertApplicant}
at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:156)
at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:61)
... 45 more
[ July 07, 2008: Message edited by: Omar Barrera ]
 
Omar Barrera
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was able to get my code to run partially correct. However I am still having an issue binding the selectonemenu item that is selected from the jsp view to the information in the bean. Again, forgive my ignorance as I am new to JSF, 1st project btw, but I thought if used the value element in the selectonemenu component tag, then the value the user selects would be bound by the get and set methods of the underlying bean.

Omar
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic