It's not a secret anymore!
The moose likes JSF and the fly likes can anybody help ?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "can anybody help ??" Watch "can anybody help ??" New topic

can anybody help ??

sudhasrinivas pallam
Ranch Hand

Joined: Oct 06, 2008
Posts: 37
This is srinivas
I developed a page with 4 dropdown lists
Now i want to change the behaviour of the dropdown lists
Intially only one dropdown list must appear
when i select any option from the list other dropdown list must appear
The code i used is

please post any suggestions
Himanshu Gupta
Ranch Hand

Joined: Aug 18, 2008
Posts: 598

for this functionality do one thing.

on onselect event submit the form and call one action. that action will set the rendered property true of the next drop down. same for rest two also.

My Blog SCJP 5 SCWCD 5
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

Hi sudhasrinivas,

I'm not an expert in JSF - so I can only give you some basic advises to your code.

1. you need to submit each time the value in the dropdown changes - use "onchange" attribute in 'h:selectOneMenu' which referrer to a JavaScript function from where you submit.

2. use some kind of boolean 'flag' to control when the other dropdown(s) should be shown - when you submit, you enter your java action bean, here you set a flag, and return to the same web page you came from (I think that the attribute to use in 'h:selectOneMenu' is called 'rendered').

Regards, Rene Larsen
Dropbox Invite
Himanshu Gupta
Ranch Hand

Joined: Aug 18, 2008
Posts: 598

Yes Rene you are correct. The problem can be solved in this way.
I agree. Here's the link:
subject: can anybody help ??
It's not a secret anymore!