Loading

Java Quick Notes

Refresh Your Java - Before Java Interview

We are Agile, believe in less Documentation - Only Quick notes (Java Interview Questions) of Java/J2ee Read more....


Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet

Go to SiteMap

Q)  Sample Event Handling in JSF ?


Ans)

Event Handling :

<h:selectOneRadio id="category"
  value="#{CDManagerBean.cd.category}"
  immediate="true"
  onclick="submit()"
  valueChangeListener="#{CDManagerBean.categorySelected}">
    <f:selectItems value="#{CDManagerBean.categories}"/>
</h:selectOneRadio>

Event Handling Method :

public void categorySelected(ValueChangeEvent event) {
    subCategoryList.setRendered(true);

    String value = (String) event.getNewValue();

    if (value != null) {
        this.subCategories = this.getSubcategoriesList(value);
    }

    FacesContext context = FacesContext.getCurrentInstance();
    context.renderResponse();
}

Managed Bean :

<managed-bean>
  <description>The "backing file"
    bean that backs up the CD application</description>
  <managed-bean-name>CDManagerBean</managed-bean-name>
  <managed-bean-class>
    com.arcmind.jsfquickstart.controller.StoreController
      </managed-bean-class>
  <managed-bean-scope>session</managed-bean-scope>
</managed-bean>



Back to top

------------------------- We hope you got necessary Info On -----------------------------------------

Event Handling in JSF


Event Handling in JSF

-------------------------------------------------------------------------------------------------------



Face Book
Request for a Mock Interview/Training

Get a PDF

Face Book
Same look (Read) on any device, this is Ads free