//Configure Ajax in Home page
When the value of the drop down value is changing the "Ajax" event will trigger rather than loading the whole page
<table>
<tr align="center" >
<td><h:outputText value="Nature of Job:"/> </td>
<td>
<h:selectOneMenu id="natureofjob" style="width: 90%;height: 30px;" value="#{country.localeCode}" >
<f:selectItem itemLabel="Select..." itemValue="Select"/>
<f:selectItem itemLabel="Typesetting/Journals" itemValue="j"/>
<f:selectItem itemLabel="Typesetting/Books" itemValue="TypeSetting/Books"/>
<f:selectItem itemLabel="Conversion/XML" itemValue="x"/>
<f:selectItem itemLabel="Conversion/eBooks" itemValue="e"/>
<f:selectItem itemLabel="WordProcess" itemValue="w"/>
<f:ajax event="valueChange" render="clients booksjournals convxml convEbook dispatchmode" listener="#{country.setNob}" />
</h:selectOneMenu>
</td>
</tr>
</table>
In above code we can see
event=valueChange //It triggers when the value of the current id is changed
render=clients books//here it affect the properties which named as "clients,books"
listener="#{coutry.setNo}"//Call listener class in source file
When triggering the Ajax event the Listenter class will begin
configuring listener class
import javax.faces.event.AjaxBehaviorEvent;
public class Bean
{
public void setNob(AjaxBehaviorEvent e)
{
//Do stuffs here
}
}
Comments
Post a Comment