• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

selectOneMenu update from backing bean

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Saloon Keeper
Posts: 24804
172
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
clara irma
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tim,

Thanks for the suggestion! I will be looking into ajax4jsf for this.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic