*
The moose likes JSF and the fly likes selectOneMenu update from backing bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "selectOneMenu update from backing bean" Watch "selectOneMenu update from backing bean" New topic
Author

selectOneMenu update from backing bean

clara irma
Greenhorn

Joined: May 06, 2009
Posts: 5
Hi All,

I'm very new in JSF development, so I'm hoping to get some pointers from you guys

I am currently developing a simple web application that displays a set of JSF components, some of them are custom JSF.

One of the components is a drop down list (I am using selectOneMenu component). I bind the value and the selectItems to my backing bean, as shown in the code below:


And in my backing bean, I have the following:
- String value;
- UISelectItems areaItems;
- and a method that fills up the content of the areaItems


The code works fine for the initial display. However, there is a custom JSF component on the page that displays an image and listens to user mouse event.
Upon mouse click, the listener (which is the backing bean) will be notified and the image being displayed will be updated.
Subsequently, the list of items displayed by the selectOneMenu needs to be updated as well (correspond to the new image).

How do I implement the refresh of selectItems in selectOneMenu upon an event received by another JSF component (and handled by the backing bean)?
Currently, upon mouse click, the image gets updated, but not the drop down menu, even though the areaItems object in the bean has been updated.

Any advise or pointers will be greatly appreciated. Thank you in advance.


♪♪♪ イルマ ♪♪♪
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15964
    
  19

Probably the easiest way is to use AJAX-enabled JSF components like those provided by JBoss RichFaces. The RichFaces controls support an attribute named "reRender" that tells what parts of the page should be updated.


Customer surveys are for companies who didn't pay proper attention to begin with.
clara irma
Greenhorn

Joined: May 06, 2009
Posts: 5
Hi Tim,

Thanks for the suggestion! I will be looking into ajax4jsf for this.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: selectOneMenu update from backing bean
 
Similar Threads
Populated UISelect components via Database
Dynamic HtmlSelectOneMenu : How to set the selected value in dropdown?
Trouble using Map with h:selectOneMenu...
Using disabled attribute in SelectOneMenu
Bean Value is always Null