3 Replies Latest reply on May 24, 2011 11:13 AM by lvdberg

    conversation Scope for next and previous

    flo076

      Hello, I am currently developing an app where I must spend more on next page with a button or return with a back button. So I read the doc on the type of scope used and it seems that the talk time would be best. So I try to do something every single page in an inputText and I put a link next to the second page and I post what I entered in the first. Until you follow me? So here I am trying to understand not fiddled with @ Begin all his but I am lost. If anyone has a solution or ways to make me move I'm interested in the meantime I'll see if Google is truly a loyal friend


      I enclose my different test file: c info for test 1 and test 2, which calls these 2 files are in one folder and a file called test.page.xml y 'in the same folder:




      Test 1 :
      <ui:define name="center">
      <h:form>
      <h:inputText value="#{test.unAttribut}" />
      </h:form>
      <h:outputLink value="Test2.seam">
      <h:outputText value="next" />
      </h:outputLink>
      </ui:define>
      
      Test 2 :
      
      <ui:define name="center">
      <h:outputText value="valeur de l'attribut : #{test.unAttribut}" />
      </ui:define> 
      
      
      import org.jboss.seam.ScopeType;
      import org.jboss.seam.annotations.Begin;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.Scope;
      
      @Name("test")
      @Scope(ScopeType.CONVERSATION)
      
      public class Test {
      
          private String unAttribut;
      
          
          public Test()
          {
              System.out.println(" \n Passe dans constructeur");
          }
          /**
           * @param unAttribut the unAttribut to set
           */
          @Begin
          public void setUnAttribut(String unAttribut) {
              System.out.println(" \n Passe dans set");
              this.unAttribut = unAttribut;
          }
      
          /**
           * @return the unAttribut
           */
          @Begin
          public String getUnAttribut() {
              System.out.println(" \n Passe dans get");
              return unAttribut;
          }
          
      }
      
        <?xml version="1.0" encoding="UTF-8" ?> 
      - <page xmlns="http://jboss.com/products/seam/pages" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.2.xsd" login-required="false">
        <begin-conversation join="true" /> 
        </page>
      



        • 1. Re: conversation Scope for next and previous
          lvdberg

          Hi,


          read the chapter about conversation scope of the doc carefully. You should create a long-running conversation when you enter the first page and end it when you leave the page.


          The most simple way is to define it in pages.xml where you add such elements in the page definition.


          Leo 

          • 2. Re: conversation Scope for next and previous
            flo076

            Hello leo,


            I read



            http://docs.jboss.org/seam/snapshot/en-US/html/conversations.html#conversations.required





            but I do not really understand the use of begin and end. I have liked a simple concrete example to show the use of all the entries. I will read all this part but if you have another link, I want to? Thank you for your reply and sorry for my English

            • 3. Re: conversation Scope for next and previous
              lvdberg

              Hi,


              The documentation should be enough, but you can also look into the software download which contains an example directory and last-but-not-least, invest in the Seam-In-Action book (manning) which contains an in-depth explanation of conversations.


              Leo