two selectOneMenu and one beginner
lhan Sep 15, 2011 3:43 PMHi people, I hope you can explain to me my problem. I have got two selectOneMenu, I need to do this: when I choose an activity, the task list must be created. But nothing happens.
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:a="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" template="layout/template.xhtml"> <ui:define name="body"> <h:form id="editForm" styleClass="edit"> <rich:panel> <f:facet name="header">Setting Activities and Tasks</f:facet> <h:inputHidden value="#{planCoAction.taskId}" /> <s:decorate id="actField" template="layout/edit.xhtml"> <ui:define name="label">Activity:</ui:define> <h:selectOneMenu id="act" value="#{planCoAction.activity}" style="width: 350px"> <s:selectItems value="#{planCoAction.actList}" var="_act" itemValue="#{_act}" label="#{_act}" noSelectionLabel="Choose one.."/> <a:support event="onchange" reRender="taskField" ajaxSingle="true" /> </h:selectOneMenu> </s:decorate> <s:decorate id="taskField" template="layout/edit.xhtml"> <ui:define name="label">Task:</ui:define> <h:selectOneMenu id="task" value="#{planCoAction.task}" style="width: 350px" required="true"> <s:selectItems value="#{planCoAction.taskList}" var="_task" itemValue="#{_task}" label="#{_task}" noSelectionLabel="Choose one.."/> </h:selectOneMenu> </s:decorate> <h:commandButton id="save" value="Save" action="#{planCoAction.saveTasks}"/> <h:commandButton id="findTasks" value="Find" action="#{planCoAction.findTasks}"/> </rich:panel> </h:form> </ui:define> </ui:composition>
The problem is that in backing bean the activity attribute never changes its value... activity is a String in planCoAction class, and it has its setActivity and getActivity. getActivity works... setActivity never was invoked when I run the web in debug mode.
Thanks in advance and sorry for my english.