Has anyone had problems combining savestate with facelets? I have a tabbed
pane set up in a step by step wizard sort of way. After the user submits the
form on the second tab, the backingbean resets! Any help would be endlessly
appreciated, This is almost a show stopper for me and I'm on the verge of a
panic attack.


Here's my code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";
      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:t="http://myfaces.apache.org/tomahawk";
      xmlns:s="http://myfaces.apache.org/sandbox";>

<t:saveState value="#{pcwBacker}"/>

<ui:composition template="/WEB-INF/layout/layout.xhtml">

                <ui:define name="title">Project Creation Wizard</ui:define>
                
                <ui:define name="pageHeader">Project Creation Wizard</ui:define>
                
                <ui:define name="left">
                        <t:panelTabbedPane styleClass="tabbedPane" 
                                        activeTabStyleClass="activeTab" 
                                        inactiveTabStyleClass="inactiveTab" 
                                        disabledTabStyleClass="disabledTab" 
                                        activeSubStyleClass="activeSub" 
                                        inactiveSubStyleClass="inactiveSub" 
                                        tabContentStyleClass="tabContent"
                                        serverSideTabSwitch="false" 
                                        
selectedIndex="#{pcwBacker.currentIncompleteStep - 1}">

                                <h:form></h:form> <!-- Addresses weird bug. Do 
not remove! -->  
                        
                                <t:panelTab label="General Information">
                                        <h:form>
                                        <t:panelGrid columns="2" 
cellpadding="10px">

                                                        <h:outputText 
value="Name: "/>
                                                        <h:panelGrid 
columns="2">
                                                                <h:inputText 
id="name" value="#{pcwBacker.name}" required="true" />
                                                                <t:message 
forceSpan="true"  for="name"/>
                                                        </h:panelGrid>
                                                        
                                                        <h:outputText 
value="Category:"/>
                                                        <h:panelGroup>
                                                                
<h:selectOneMenu id="category" value="#{pcwBacker.category.id}"
required="true">
                                                                        
<f:selectItems value="#{pcwBacker.categoryItems}"/>
                                                                
</h:selectOneMenu>
                                                                <t:message 
forceSpan="true"  for="category"/>
                                                        </h:panelGroup>
                                                

                                                        <h:outputText 
value="Status:"/>
                                                        <h:panelGroup>
                                                                
<h:selectOneMenu id="status" value="#{pcwBacker.status.id}">
                                                                        
<f:selectItems value="#{pcwBacker.statusItems}"/>
                                                                
</h:selectOneMenu>                      
                                                                <t:message 
forceSpan="true"  for="status"/>
                                                        </h:panelGroup> 
                                                

                                                        <h:outputText 
value="Phase: "/>
                                                        <h:panelGroup>
                                                                
<h:selectOneMenu id="phase" value="#{pcwBacker.phase.id}">
                                                                        
<f:selectItems value="#{pcwBacker.phaseItems}"/>
                                                                
</h:selectOneMenu>
                                                                <t:message 
forceSpan="true"  for="phase"/>
                                                        </h:panelGroup> 
                                                

                                                        <h:outputText 
value="Date Due: "/>
                                                        <h:panelGroup>
                                                                <t:inputDate 
id="date" type="date" value="#{pcwBacker.dueDate}"
required="true" 
                                                                                
popupCalendar="true"/>
                                                                <t:message 
forceSpan="true"  for="date"/>
                                                        </h:panelGroup> 
                                                
                                                <t:commandButton 
action="#{pcwBacker.enableStepTwo}" 
                                                        
value="#{pcwBacker.completed ? 'Update' : 'Next Step'}"
styleClass="btn"/>
                                        </t:panelGrid>
                                        </h:form>
                                </t:panelTab>
                                
                                <t:panelTab 
rendered="#{pcwBacker.stepTwoEnabled}" label="People
Involved">
                                        <h:form>
                                        <t:panelGrid columns="1" 
cellpadding="10px">
                                                <t:panelGroup>
                                                        <h:outputText 
value="Leader: "/>
                                                        <h:selectOneMenu 
id="leader" value="#{pcwBacker.leaderId}"
required="true">
                                                                <f:selectItems 
value="#{pcwBacker.workerItems}"/>
                                                        </h:selectOneMenu>
                                                        <t:message for="leader" 
forceSpan="true"/>
                                                </t:panelGroup>

                                                <t:panelGroup>
                                                        <h:outputText 
value="Assignees: "/>
                                                        <s:selectManyPicklist 
id="assignees" value="#{pcwBacker.assignees}"
size="5">
                                                                <f:selectItems 
value="#{pcwBacker.workerItems}"/>
                                                        </s:selectManyPicklist>
                                                        <t:message 
for="assignees" forceSpan="true"/>
                                                </t:panelGroup>
                                                
                                                <t:commandButton 
action="#{pcwBacker.enableStepThree}" 
                                                                
value="#{pcwBacker.completed ? 'Update' : 'Next Step'}"
styleClass="btn"/>
                                        </t:panelGrid>
                                        </h:form>
                                </t:panelTab>
                        
                                <t:panelTab 
rendered="#{pcwBacker.stepThreeEnabled}" label="Project
Description">
                                        <h:form>
                                        <t:panelGrid columns="1">
                                                <t:outputText value="Breif 
Description:"/>
                                                <t:inputTextarea 
value="#{pcwBacker.description}"/>
                                                <t:commandButton 
action="#{pcwBacker.enableFinalStep}" 
                                                                
value="#{pcwBacker.completed ? 'Update' : 'Next Step'}"
styleClass="btn"/>
                                        </t:panelGrid>
                                        </h:form>
                                </t:panelTab>
                                
                                <t:panelTab 
rendered="#{pcwBacker.finalStepEnabled}" label="Final">
                                        <h:form>
                                        <t:panelGrid columns="1">
                                                <t:commandButton value="Save" 
action="#{pcwBacker.save}"
styleClass="btn"/>
                                        </t:panelGrid>
                                        </h:form>       
                                </t:panelTab>
                        
                        </t:panelTabbedPane>
                </ui:define>
                
                                
                <ui:define name="right">
                        <t:div styleClass="sectionHeader">                      
                                <t:outputText value="Summery"/>
                                <t:outputText value=" of '#{pcwBacker.name}'" 
rendered="#{pcwBacker.name
!= null}"/>
                        </t:div>
                        
                        <t:panelGrid columns="1" cellpadding="5px">
                                <t:outputText value="Category: 
#{pcwBacker.category.name}"
rendered="#{pcwBacker.phase.name != null}"/>
                                <t:outputText value="Status: 
#{pcwBacker.status.name}"
rendered="#{pcwBacker.status.name != null}"/>
                                <t:outputText value="Phase: 
#{pcwBacker.phase.name}"
rendered="#{pcwBacker.phase.name != null}"/>                    
                                <t:outputText value="Date Due: 
#{pcwBacker.dueDate}"
rendered="#{pcwBacker.dueDate != null}"/>
                                <t:outputText value="Leader: 
#{pcwBacker.leader.fullName}"
rendered="#{pcwBacker.leader != null}"/>
                                
                                <t:panelGroup rendered="#{pcwBacker.description 
!= null}">
                                        <t:outputText value="Description: 
'#{pcwBacker.description}'"/>
                                </t:panelGroup>
                                
                                <t:panelGroup rendered="#{pcwBacker.assignees 
!= null}">
                                        <t:outputText value="Assignees: "/>
                                        <t:dataList var="assignee" 
value="#{pcwBacker.assignees}">
                                                <t:outputText 
value="#{pcwBacker.names[assignee]}, " 
                                                                
rendered="#{pcwBacker.names[assignee] ne
pcwBacker.leader.fullName}"/>
                                        </t:dataList>
                                        <t:outputText value="and project leader 
#{pcwBacker.leader.fullName}"/>
                                </t:panelGroup>
                        </t:panelGrid>
                </ui:define>
</ui:composition>

</html>

--
View this message in context: 
http://www.nabble.com/Problems-With-saveState-t1780890.html#a4848834
Sent from the MyFaces - Users forum at Nabble.com.

Reply via email to