File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes SelectItem Help needed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "SelectItem Help needed" Watch "SelectItem Help needed" New topic

SelectItem Help needed

Omar Barrera

Joined: Aug 17, 2005
Posts: 15
I need some help with an issue that is driving me mad. I have a state list populated by a bean. I have my form, and it displays correctly. However, the value selected in the list is never saved. I can not figure out what is wrong with my code. FYI, I am using the MyFaces implementation of JSF. Here is my code.


Sachin Satija

Joined: Aug 24, 2005
Posts: 28
The code looks good.... I tried copying the code in a test project and it worked... On the click of a submit button the state is getting saved.... Here are a few things I would suggest(if you haven't already done that):
1.) Check if any other text box in the form which is binded to the same value(i.e selected state).

2.) Try Taking this code out in a test project and use a couple of jsps to achieve the results.

P.S: I used My Faces 1.1.4 and Java Compiler 1.4. So had to change List<T> to List but that should not effect.

What is the Myfaces version you are using and also can you paste the complete JSP page and the faces-config.xml.


SCJP1.4--91%<br />IBM 399
Omar Barrera

Joined: Aug 17, 2005
Posts: 15
Hello Sachin, thank you for responding promptly. I am using MyFaces 1.1.5 and java 5. Unfortunately I am not at liberty to post my jsp page. I appreciate your response on this matter. However I will say that my other jsf components are binding with the component via the jsf api properly. This leads me to believe that there is some weird behavior occurring because of the portlet container I am using. Very discouraging, but I will continue to try and isolate the problem.

Kind Regards,

Bhaskar GR

Joined: Jun 13, 2008
Posts: 28
Hi ,First write binding input to slectOneMenu in jsp page.Write

private HtmlSelectOneMenu inputBinding;
in method calling
It gives wht you selected value;
Zack Marrapese

Joined: Jul 02, 2008
Posts: 27
I believe that since you set immediate="true", it's never getting to the point where it actually puts the new value into the backing just skips ahead to rendering the response.
I agree. Here's the link:
subject: SelectItem Help needed
It's not a secret anymore!