i'm trying to write simple jsf-based application, but there is a problem i cannot to solve. I need list of links on page, so i'm iterating to output them on the page using t:dataList tag from Tomahawk library.
/list.jsp
<f:view>
<h:form>
<t:dataList value="#{someBean.listOfNews}" var="news" >
<h:commandLink value="edit" action="#{someBean.edit}">
<f:setPropertyActionListener target="#{someBean.id}" value="#news.id}" />
</h:commandLink>
</t:dataList>
</f:view>
</h:form>
As you can see, i have a list of "news" in my managed bean. But it isn't important. By clicking on the link i want to redirect to page /add.jsp
faces-config.xml
<navigation-rule>
<from-view-id>/list.jsp</from-view-id>
<navigation-case>
<from-outcome>edit</from-outcome>
<to-view-id>/add.jsp</to-view-id>
<redirect></redirect>
</navigation-case>
</navigation-rule>
But i get this exception instead:
java.lang.IllegalStateException
at org.apache.catalina.connector.ResponseFacade.sendRedirect(ResponseFacade.java:435)
at com.sun.faces.context.ExternalContextImpl.redirect(ExternalContextImpl.java:572)
at com.sun.faces.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:178)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:126)
at org.apache.struts.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:137)
at javax.faces.component.UICommand.broadcast(UICommand.java:311)
at javax.faces.component.UIData.broadcast(UIData.java:912)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:781)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1246)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Unknown Source)
But if i try to not use this tag, such as
<f:view>
<h:form>
<h:commandLink value="edit" action="#{someBean.edit}">
<f:setPropertyActionListener target="#{someBean.id}" value="1" />
</h:commandLink><br>
<h:commandLink value="edit" action="#{someBean.edit}">
<f:setPropertyActionListener target="#{someBean.id}" value="2" />
</h:commandLink>
</h:form>
</f:view>
it works fine. if i don't use tag in navigation-rule it's also works fine. Can anybody explain this incompatibility t:dataList and redirect?