auj:support is not triggering a event
shivaji.byrapaneni Jun 24, 2009 1:55 AMHi There,
I had a sitaution in which when i select a value form the combo box a action listener in my backing bean need to be triggered. For that i had this code in my JSP
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> <!-- RichFaces tag library declaration --> <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%> <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <f:subview id="ApproverView"> <h:panelGrid columns="2"> <h:outputText value="Course Name to approve : " /> <rich:comboBox value="#{approveCoursesBean.courseName}" directInputSuggestions="true" defaultLabel="Enter Course Name"> <a4j:support event="onSelect" rendered="approveLS" actionListener="#{approveCoursesBean.populateNominationListBasedOnCourseSelected}" /> <f:selectItems value="#{nominationSessionBean.courseNames}" /> </rich:comboBox></h:panelGrid> <rich:spacer height="20" /> <rich:listShuttle sourceValue="#{approveCoursesBean.approvedList}" targetValue="#{approveCoursesBean.nominatedList}" var="people" sourceCaptionLabel="Nominated people" targetCaptionLabel="Approved people" id="approveLS" converter="approveCoursesConverter"> <rich:column width="18"> <h:graphicImage value="#{people.iconURI}" width="30px" height="30px" /> </rich:column> <rich:column> <h:outputText value="#{people.userId}" /> </rich:column> <rich:column> <h:outputText value="#{people.userName}" /> </rich:column> <!--<a4j:support event="onlistchanged" reRender="toolBar" /> <a4j:support event="onorderchanged" reRender="toolBar" /> --> </rich:listShuttle> </f:subview>
and the above page will be included into below page as shown
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> <!-- RichFaces tag library declaration --> <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%> <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%> <html> <head> <title>:: Nomination system Home ::</title> <script src="/NominationWeb/scripts/nominationScripts.js" type="text/javascript"></script> </head> <body> <f:view> <a4j:form id="nominationSystemHome" binding="#{homeBean.nominationSystemHome}"> <rich:tabPanel switchType="ajax" id="nominationHometp" binding="#{homeBean.nominationHometp}"> <rich:tab label="Course List" id="courseListTab" binding="#{homeBean.courseListTab}" action="#{courseListBean.loadCourseList}"> <rich:messages /> <%@ include file="/pages/courseList.jsp"%> </rich:tab> <rich:tab label="Approve Nominations" id="approveNominationsTab" binding="#{homeBean.approveNominationsTab}" action="#{approveCoursesBean.populateCourseListToApprove}"> <rich:messages /> <%@ include file="/pages/approveCourses.jsp"%> </rich:tab> <rich:tab label="Manage Courses" id="manageCoursesTab" binding="#{homeBean.manageCoursesTab}" action="#{manageCoursesBean.loadManageCourses}"> <rich:messages /> <%@ include file="/pages/manageCourses.jsp"%> </rich:tab> <rich:tab label="Manage Users" id="manageUsersTab" binding="#{homeBean.manageUsersTab}" > <rich:messages /> <p>Managing users goes here.</p> </rich:tab> </rich:tabPanel> </a4j:form> <%@ include file="/pages/manageCourseSupport.jsp"%> <%@ include file="/pages/processing.jsp"%> </f:view> </body> </html>
in my backing bean i had teh associated action listener like this
package com.managedbeans; import java.util.ArrayList; import javax.faces.event.ActionEvent; import javax.faces.model.SelectItem; import com.entities.CourseDetailsEO; import com.logger.NominationLogger; import com.vo.ApproveVO; public class ApproveCoursesBean extends NominationBaseBean { private final String className = this.getClass().toString(); private String courseName ; private ArrayList<ApproveVO> nominatedList = new ArrayList<ApproveVO>(); private ArrayList<ApproveVO> approvedList = new ArrayList<ApproveVO>(); public ArrayList<ApproveVO> getNominatedList() { return nominatedList; } public void setNominatedList(ArrayList<ApproveVO> nominatedList) { this.nominatedList = nominatedList; } public String getCourseName() { return courseName; } public void setCourseName(String courseName) { this.courseName = courseName; } public ArrayList<ApproveVO> getApprovedList() { return approvedList; } public void setApprovedList(ArrayList<ApproveVO> approvedList) { this.approvedList = approvedList; } public String populateCourseListToApprove() { final String methodName = "populateCourseListToApprove"; NominationLogger.logMethodEntry(className, methodName); ArrayList<CourseDetailsEO> courseList = getNominationSessionBean().getCoursesList(); getNominationSessionBean().setCourseNames(new SelectItem[courseList.size()]); CourseDetailsEO courseDetailsEO = null ; for(int a = 0; a < courseList.size() ; a++){ courseDetailsEO = courseList.get(a); getNominationSessionBean().getCourseNames()[a] = new SelectItem(courseDetailsEO.getCourseName()); } NominationLogger.logMethodExit(className, methodName); return null; } public String populateNominationListBasedOnCourseSelected(ActionEvent event) { final String methodName = "populateNominationListBasedOnCourseSelected"; NominationLogger.logMethodEntry(className, methodName); NominationLogger.info(this.courseName); NominationLogger.logMethodExit(className, methodName); return null; } }
i cant see the a4j:support getting triggered. i even tried the valuechangelistener option of rich:combobox and that even didnt help.
please correct me.
many thanks in advance.