I am using <h:CommandLink> with an action, actionListener, and
immediate=true.
I was of the understanding that, after my actionListener and action finished
executing, processing would continue with the Process Validation, validating
non-immediate components, unless I called renderResponse() in the action
listener or returned a non-null String from the action or method.
Instead, what I am seeing is that it goes to Render Response even though I
do not call renderResponse( ) in the action listener method and do return
null from the action. (I have a PhaseListener to print which phases I'm
starting and ending). When I remove the immediate attribute, it does call
the other validator(s). Any ideas why?
<body onload="doOnload();">
<h:form id="custSearchForm">
<h:outputText id="pageHeader" value="Customer Search" />
<h:messages styleClass="error" infoStyle="color:orange"
showDetail="#{true}" showSummary="#{false}" />
<br/>
Name:
<h:inputText id="name" value="#{customerSearchBean.name}"
required="true"
onkeypress="return KeyPressed(event)" >
<f:converter converterId="jimdl.UpperNameConverter"/>
<f:validateLength minimum="2" maximum="25" />
</h:inputText>
<h:commandButton style="width:80px" value="Search"
action="#{customerSearchBean.loadCustomer}" />
</br>
<h:commandLink immediate="true"
action="#{customerSearchBean.doNothing}"
actionListener="#{customerSearchBean.toggleHeader}" value="ToggleHeader"/>
</h:form>
</f:view>
</body>
In CustomerSearchBean:
public void toggleHeader(ActionEvent actionEvent) {
System.out.println(((UIComponent)actionEvent.getSource()).getId());
}
public String doNothing() {
return null;
}
I am using MyFaces 1.1.6 on Apache Tomcat 5.5.
Incidentally, I downloaded the source for MyFaces, and the the
ActionListenerImpl class, which calls the action method calls
application.getNavigationHandler().handleNavigation(...), which does nothing
because my action method returned a null. Then, the ActionListenerImpl
calls renderResponse()!
navigationHandler.handleNavigation(facesContext, fromAction,
outcome);
//Render Response if needed
facesContext.renderResponse();
Any idea why?
--
View this message in context:
http://www.nabble.com/Unexpected-Phases-with-CommandLink-using-immediate-attrib-tp21673991p21673991.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.