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 display a profile of the car  on the same page - with h:selectOneListbox 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 "display a profile of the car  on the same page - with h:selectOneListbox" Watch "display a profile of the car  on the same page - with h:selectOneListbox" New topic
Author

display a profile of the car on the same page - with h:selectOneListbox

chetan padhye
Greenhorn

Joined: Apr 17, 2008
Posts: 15
Hi

My select list is like below .... and on selection of any of option on it i want to display a profile of the car on the same page .....what can be possible options and the best option ?


<h:selectOneListbox id="pickCar"
value="#{carBean.currentCar}">
<f:selectItems
value="#{carBean.carList}" />
</h:selectOneListbox>

Please tell me , how do i change the values of existing components on the screen on some valueChangeEvent ?

Thanks in advance
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Several ways. Do you want to do it synchronously? Just submit the form to the server on change of the dropdown. Do you want to do it asynchronously? Consider using Ajax4jsf (part of RichFaces) to rerender the desired part of the page on change of the dropdown. Do you want to do it entirely clientside? Print all desired values to some Javascript array and use Javascript to display the desired part of the page on change of the dropdown.

The valueChangeEvent isn't of interest. You're not interested in the old value.
chetan padhye
Greenhorn

Joined: Apr 17, 2008
Posts: 15
Thanks for reply

Ajax4jsf sounds best option here ....do you have any example ....

Thanks ...
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Documentation, tutorials and examples enough at their own homepage.
chetan padhye
Greenhorn

Joined: Apr 17, 2008
Posts: 15
Thanks




Rahul Santha
Greenhorn

Joined: Apr 17, 2008
Posts: 12
You need to do Ajax refresh after the onChange event of dropdown.

Below link is something similar.. but it uses IBM JSF Ajax component.
http://www.ibm.com/developerworks/rational/library/06/1205_kats_rad2/

Thanks,
Santha


Thanks!<br />Rahul, IOWA
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: display a profile of the car on the same page - with h:selectOneListbox
 
Similar Threads
Select the default value based on previous selection in select box
Select problem
Help - question on selectOneListbox and page reloads
Spurious valueChangeListener calls on same JSP page
2 - Questions regarding <h:selectOneListbox...>