File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

on change combo box not working.

 
Kondal reddy
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Iam trying to do onchange selectOneMenu is not working but if I put submit button it is working?(I am using valueChangeListener).
any body can help ...when I onchange my combo box, I want to change value in down side combo box ....actually when I select state combobox, only it has to disply cities in my down combobox.
 
Kondal reddy
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is my JSP:


<h:selectOneMenu styleClass="selectOneMenu" id="menu1" value="#{deemListBean.tempState}" onchange="submit();" valueChangeListener="#{deemListBean.listenerStateName}" >

<f:selectItems value = "#{deemListBean.getState}" />
</h:selectOneMenu>

<h:selectOneMenu styleClass="selectOneMenu" id="menu2" value="#{deemListBean.tempCity}" >

<f:selectItems value = "#{deemListBean.getCity}" />
</h:selectOneMenu>

<hx:commandExButton type="submit" value="Submit"
styleClass="commandExButton" id="button1"></hx:commandExButton>


And my Backing Bean is:


public void listenerStateName(ValueChangeEvent vce){


System.out.println("inside listenerStateName");
String value = "";

value = (String)vce.getNewValue();

System.out.println("********* The new Value is = "+value);
FacesContext fc = FacesContext.getCurrentInstance();
fc.renderResponse();
deemListBO= this.serviceLocator.getConcreteDeemListService().getCity(value);
setCity(deemListBO.getCity());
System.out.println("********* The new Value is = "+city);



}

any body can help.
 
Kondal reddy
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is my JSP:


<h:selectOneMenu styleClass="selectOneMenu" id="menu1" value="#{deemListBean.tempState}" onchange="submit();" valueChangeListener="#{deemListBean.listenerStateName}" >

<f:selectItems value = "#{deemListBean.getState}" />
</h:selectOneMenu>

<h:selectOneMenu styleClass="selectOneMenu" id="menu2" value="#{deemListBean.tempCity}" >

<f:selectItems value = "#{deemListBean.getCity}" />
</h:selectOneMenu>

<hx:commandExButton type="submit" value="Submit"
styleClass="commandExButton" id="button1"></hx:commandExButton>


And my Backing Bean is:


public void listenerStateName(ValueChangeEvent vce){


System.out.println("inside listenerStateName");
String value = "";

value = (String)vce.getNewValue();

System.out.println("********* The new Value is = "+value);
FacesContext fc = FacesContext.getCurrentInstance();
fc.renderResponse();
deemListBO= this.serviceLocator.getConcreteDeemListService().getCity(value);
setCity(deemListBO.getCity());
System.out.println("********* The new Value is = "+city);



}

any body can help.
 
Richard Green
Ranch Hand
Posts: 536
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the scope of your managed bean?
 
JR Yalbets
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Add



to the selectOneMenu tag and it should work. This will "short circuit" the lifecyle and be handled right away instead of being queued and processed later when submitted.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic