The *.page.xml navigation broken when h:commandButton placed in facelet
twhitehead.twhiteheadjm.hotmail.com Mar 14, 2008 2:43 PMI started with code generated by seam-gen. I then started reading up on facelets (which I am new to) and realized that it would make sense to put the generated actionButtons div into a facelet referenced by custom tag.
So I took this:
<div class="actionButtons"> <h:commandButton value="Save" action="#{valPilotHome.persist}" disabled="#{!valPilotHome.wired}" rendered="#{!valPilotHome.managed}" /> <h:commandButton value="Save" action="#{valPilotHome.update}" rendered="#{valPilotHome.managed}" /> <h:commandButton value="Delete" action="#{valPilotHome.remove}" immediate="true" rendered="#{valPilotHome.managed}" /> <s:button value="Done" propagation="end" view="/ValPilotList.xhtml" rendered="#{valPilotHome.managed}" /> <s:button value="Cancel" propagation="end" view="/ValPilotList.xhtml" rendered="#{!valPilotHome.managed}" /> </div>
and it becomes this:
<val:actionButtons listPage="/ValPilotList.xhtml" backingBean="#{valPilotHome}" />
with val:actionButtons being in a xhtml file containing:
<!DOCTYPE html 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:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ice="http://www.icesoft.com/icefaces/component"> <div class="actionButtons"> <h:commandButton value="Save" action="${backingBean.persist}" disabled="${!backingBean.wired}" rendered="${!backingBean.managed}" /> <h:commandButton value="Save" action="${backingBean.update}" rendered="${backingBean.managed}" /> <h:commandButton value="Delete" action="${backingBean.remove}" immediate="true" rendered="${backingBean.managed}" /> <s:button value="Done" propagation="end" view="${listPage}" rendered="${backingBean.managed}" /> <s:button value="Cancel" propagation="end" view="${listPage}" rendered="${!backingBean.managed}" /> </div> </ui:composition>
This has so many advantages including:
making my pages much easier to read.
making it easier to make changes if I decide I want to change the layout of the buttons etc.
However, the problem is that my navigation rules in the ValPilotExit.page.xml file no longer work!
<navigation from-action="#{valPilotHome.persist}"> <end-conversation /> <redirect view-id="/ValPilot.xhtml" /> </navigation> <navigation from-action="#{valPilotHome.update}"> <end-conversation /> <redirect view-id="/ValPiloList.xhtml" /> </navigation> <navigation from-action="#{valPilotHome.remove}"> <end-conversation /> <redirect view-id="/ValPilotList.xhtml" /> </navigation>
What am I not seeing?