Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can anybody help ??

 
sudhasrinivas pallam
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
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
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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').
 
Himanshu Gupta
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes Rene you are correct. The problem can be solved in this way.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic