0 Replies Latest reply on Nov 22, 2010 3:18 PM by Piotr Salski

    How to keep data in JPDL pageflow

    Piotr Salski Newbie

      I have an issue. On one page (1) I enter some date and I choose one future from drop down list. If there is not item in that drop down list you can add it by clicking link (s:link) and you will be redirected to page (2) where you can add new item to that list. When you done you click finish and you will go back to previous page. When I go back I would like to have all previously entered data into inputText prefilled as they ware. How to do this?


      My page (1)


      <h:form id="doctorForm">
      
              <rich:panel>
                  <f:facet name="header">doctor</f:facet>
      
                  <s:decorate id="fnameField" template="layout/edit.xhtml">
                      <ui:define name="label">Imie</ui:define>
                      <h:inputText id="name" required="true"
                                   value="#{TBL_Doctor.first_name}"/>
                  </s:decorate>
                   <s:decorate id="lnameField" template="layout/edit.xhtml">
                      <ui:define name="label">Nazwisko</ui:define>
                      <h:inputText id="name" required="true"
                                   value="#{TBL_Doctor.last_name}"/>
                  </s:decorate>
                   <s:decorate id="PHDField" template="layout/edit.xhtml">
                      <ui:define name="label">PHD</ui:define>
                      <h:inputText id="name" required="true"
                                   value="#{TBL_Doctor.PHD}"/>
                  </s:decorate>
                  <s:decorate id="ProfField" template="layout/edit.xhtml">
                    <ui:define name="label">Specjalizacja</ui:define>
                    <h:selectOneMenu value="#{TBL_Doctor.profesion}"
                                    converter="#{ProfessionBean.converter}"           
                                               required="true">
                                  <f:selectItems value="#{ProfessionBean.professionListMap}" />
                       </h:selectOneMenu>
                       <s:link action="addProfession">
                                  <h:outputText value="[Dodaj nowa specjalizacje]"/>
                              </s:link>
                  </s:decorate>
                 
      
      
                  <div style="clear:both"/>
      
              </rich:panel>
      
              <div class="actionButtons">
      
                  <h:commandButton value="Cancel" action="cancel"  immediate="true"/>
                  <h:commandButton value="Add" action="addDoctor"/>
                
              </div>
      
          </h:form>



      my page (2)


       <h:form id="professionEntityForm">
      
              <rich:panel>
                  <f:facet name="header">professionAdd</f:facet>
      
                  <s:decorate id="nameField" template="layout/edit.xhtml">
                      <ui:define name="label">Profession</ui:define>
                      <h:inputText id="name" required="true"
                                   value="#{TBL_profession.profession}"/>
                  </s:decorate>
      
                  <div style="clear:both"/>
      
              </rich:panel>
      
              <div class="actionButtons">
                  <h:commandButton id="save"
                                value="Add"
                               action="save_prof"
                            />
                 
              </div>
      
          </h:form>




      and finaly my JPDL


      <?xml version="1.0" encoding="UTF-8"?>
      <pageflow-definition name="new-doctor">
           <start-page name="entry" view-id="/doctorAdd.xhtml">
              <redirect/>
              <transition name="addDoctor" to="end">
                  <action expression="#{DoctorBean.AddDoctor}"/>
              </transition>
              <transition name="addProfession" to="new_profession">
                    </transition>       
              <transition name="cancel" to="end">
                  <action expression="#{DoctorBean.AddDoctor}"/>
              </transition>
          </start-page>
          <page name="new_profession" view-id="/professionAdd.xhtml">
              <redirect/>
                 <transition name="save_prof" to="entry">
                  <action expression="#{ProfessionBean.AddProfession}"/>
              </transition>
          </page>   
          <page name="end" view-id="/home.xhtml">
              <redirect/>
              <end-conversation/>
          </page>
      </pageflow-definition>