A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
JavaRanch
»
Java Forums
»
Java
»
JSF
Author
Replace JSF valueChangeListener Tag
Dan Parsons
Ranch Hand
Joined: May 30, 2007
Posts: 70
posted
Jan 11, 2009 16:51:19
0
I am using
Tomcat
and cant use
JSF
on our web container. With no JSF I cant use the JSF valueChangeListener Tag.
Please advise what I can substitute for the below valueChangeListener so I can get this to work for my dynamic drop downs:
<h:selectOneMenu value="#{Bean.selectedItem1}" valueChangeListener="#{Bean.myValueChangeListener}" onchange="submit();"> <f:selectItems value="#{bean.list1}" ></h:selectOneMenu> <h:selectOneMenu value="#{Bean.selectedItem2}"> <f:selectItems value="#{bean.list2}" ></h:selectOneMenu>
Bean:
private String selectedItem1 = ""; //holds selected value from combo1 private String selectedItem2 = "";//holds selected value from combo2 private ArrayList list1 = null; //combo1 list private ArrayList list2 = null; //combo2 list public Bean(){ list1 = new ArrayList(); //add some SelectItems to list1 //it can be done somwhere else than this constructor // list2 = new ArrayList();//leave empty, or add one row informing that you need to choose value from combo1 first //ie. list2.add(new SelectItem("","Choose combo1 value first 1));// } public void myValueChangeListener(ValueChangeEvent e) throws ... { selectedItem1 = e.getNewValue(); fillList2(selectedItem1); } private void fillList2(String selectedItem1){ //this method fills list2 //ie from query String query = "SELECT * FROM users WHERE group_id="+selectedItem1; ... ... ... }
Bauke Scholtz
Ranch Hand
Joined: Oct 08, 2006
Posts: 2458
posted
Jan 11, 2009 17:57:37
0
Crossposted:
http://forums.sun.com/thread.jspa?messageID=10570111#10570111
Please read this:
http://faq.javaranch.com/java/BeForthrightWhenCrossPostingToOtherSites
Code depot of a Java EE / JSF developer
|
JSF / Eclipse / Tomcat kickoff tutorial
|
DAO kickoff tutorial
|
I ♥ Unicode
I agree. Here's the link:
http://aspose.com/file-tools
subject: Replace JSF valueChangeListener Tag
Similar Threads
Find matches in two collections
ConversationalScoped not working
ValuechangeListener does not change the value
How to create an action listner?
Dependent Drop- Down
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter