jsf 1.2 - JSF 1.2 hx selectone menu, on change update content without page refresh -


i have page selectonemenu , wondering if there way can update content in div without page refresh. trying right , doesnt work. know can onchange="submit()", refreshes page, dont want page refresh also, possible hx:behavior and/or ajaxrefreshsubmit? if yes can show me simple example achieve that. help

<hx:selectonemenu value="#{bean.myvalue}"     valuechangelistener="#{controller.valuechangemethod}">     <f:selectitems value="#{bean.values}" /> </hx:selectonemenu>  <div id="divtobeupdated"> #{bean.displayvalue} </div> 

you use ajax above purpose. here sample code

<h:form id="welcome"> <h:selectonemenu id="countrydropdown" value="#{pracbb.mycountry}" >  <f:selectitem itemlabel="india" itemvalue="ind"/> <f:selectitem itemlabel="usa" itemvalue="usa"/> <a4j:support event="onchange"  action="#{pracbb.changedata}" rerender="welcome">        </a4j:support>  </h:selectonemenu>    <h:outputtext value="#{pracbb.dynamicstring}"/> </h:form> 

backing bean code private string mycountry;

private string dynamicstring="default";   public void changedata()  {        if(mycountry.equalsignorecase("usa"))     {         dynamicstring="you have selected usa";       }      else     {         dynamicstring="you have selected india";      }  } 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -