This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSF and the fly likes Problem using more than one listbox on a page? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Problem using more than one listbox on a page?" Watch "Problem using more than one listbox on a page?" New topic
Author

Problem using more than one listbox on a page?

Darrin Smith
Ranch Hand

Joined: Aug 04, 2003
Posts: 276
I'm running into something strange with two single selection list boxes on the same page.

When the user clicks on the first one, my app's processValueChange for that listbox gets called and the app goes to the database and retrieves information to populate the second list box.

That part works just fine!

When the user selects an item in the second listbox, the same thing is supposed to happen in that the application should go to processValueChanged for the second listbox.

That part does not work!

The processValueChanged method is not getting called although the page does submit and refresh the second listbox with the default values (item1, item2, item3). Note that the first listbox is unaffected (it still has the data that it was originally populated with in the constructor).

Here is the specific jsp:




My java code looks like this:



Can anyone tell me why the first listbox's processValueChange is being invoked but the processValueChange for the second listbox never gets called?

Is there some sort of issue with having more than one listbox on the same page in JSF?

Thanks!
Darrin Smith
Ranch Hand

Joined: Aug 04, 2003
Posts: 276
Never mind...I just solved it.

What I needed to do was to store off the list for the second listbox and repopulate it in the constructor just like the first one. I also save off the "index" of the two list boxes and reset them as well.

After doing this, it seemed to work just fine.

Odd though that it would not call the second processValueChange before this, but as long as it works now...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem using more than one listbox on a page?
 
Similar Threads
Problem using valueChangeListener and onchange
Formatting problem.
radio button not working with panelgrid
problem in using richfaces
Unexpectedly getting exception in JSF 1.2 (Urgent)