5 Replies Latest reply on Jul 8, 2011 4:21 AM by rzoller

    Page parameters with seam 2.2.2

    rzoller

      Hi,


      I'm testing a little bit around with seam and try to get page parameters working. I've got a page with




      <s:button action="/fallbearbeiten/msp.xhtml"
         value="Meilensteinplan bearbeiten (neu)"
         rendered="#{not empty task.variables.get('fallID')}"
         taskInstance="#{task}" >
            <f:param name="fallId" value="#{task.variables.get('fallID')}" />
      </s:button>




      with an entry in pages.xml




       <page login-required="true" view-id="/fallbearbeiten/msp.xhtml">
              <begin-conversation join="true" />
              <param name="fallId" value="#{fallHome.fallId}" />
              <action execute="#{fallHome.wire}"/>
       </page>
      




      The entity looks like this




      @Name("fallHome")
      public class FallHome extends EntityHome<Fall> {
      
              @In(create = true)
              SachbearbeiterHome sachbearbeiterHome;
      
              public void setFallId(Integer id) {
                      setId(id);
              }
      
              public Integer getFallId() {
                      return (Integer) getId();
              }
      
              @Override
              protected Fall createInstance() {
                      Fall fall = new Fall();
                      return fall;
              }
      
              public void load() {
                      if (isIdDefined()) {
                              wire();
                      }
              }
      
              public void wire() {
                      getInstance();
                      Sachbearbeiter sachbearbeiter = sachbearbeiterHome.getDefinedInstance();
                      if (sachbearbeiter != null) {
                              getInstance().setSachbearbeiter(sachbearbeiter);
                      }
              }
      
              public boolean isWired() {
                      if (getInstance().getSachbearbeiter() == null)
                              return false;
                      return true;
              }
      
              public Fall getDefinedInstance() {
                      return isIdDefined() ? getInstance() : null;
              }
      
              public List<Bericht> getBerichts() {
                      return getInstance() == null ? null : new ArrayList<Bericht>(
                                      getInstance().getBerichts());
              }
      
              public List<Diagnose> getDiagnoses() {
                      return getInstance() == null ? null : new ArrayList<Diagnose>(
                                      getInstance().getDiagnoses());
              }
      
              public List<Upload> getUploads() {
                      return getInstance() == null ? null : new ArrayList<Upload>(
                                      getInstance().getUploads());
              }
      
              public List<Logeintrag> getLogeintrags() {
                      return getInstance() == null ? null : new ArrayList<Logeintrag>(
                                      getInstance().getLogeintrags());
              }
      
      }





      and finally the msp.xhtml like this:



      <!DOCTYPE composition 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:f="http://java.sun.com/jsf/core"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:rich="http://richfaces.org/rich"
              xmlns:a4j="http://richfaces.org/a4j"
              template="../layout/template.xhtml">
      
              <ui:define name="body">
      
                      <h1>Meilensteinplan fuer Fall "<h:outputText value="#{fallHome.id}" />"</h1>
              
              </ui:define>
      
      </ui:composition>



      but the setFallId()-method is never called an the expression in msp.xhtml is always empty. Can somebody help me to bring it working? I'm using Seam 2.2.2 with JBoss 5.1


      Thank you


      René

        • 1. Re: Page parameters with seam 2.2.2
          kwutzke

          Are you sure


          <h1>Meilensteinplan fuer Fall "<h:outputText value="#{fallHome.id}" />"</h1>



          is what you want? I'd say you mean:


          <h1><h:outputText value="Meilensteinplan fuer Fall #{fallHome.id}" /></h1>



          Karsten

          • 2. Re: Page parameters with seam 2.2.2
            rzoller

            Hello Carsten,


            thank you for your reply. You're right. I changed it like you suggested. But there is still no parameter passed :(.
            In the documentation it seems easy and in the seam-gen generated pages it works, but in that easy case not...


            René

            • 3. Re: Page parameters with seam 2.2.2
              rzoller

              I found out something interesting:


              When I'm logged in and I open the page manually like:



              /fallbearbeiten/msp.seam?cid=25&fallId=65




              it works as expected. But with using the button it still doesn't work. So I changed button to link to see what seam is generating:



              /fallbearbeiten/auswahl.seam?fallId=65&actionOutcome=%2Ffallbearbeiten%2Fmsp.xhtml&cid=21&taskId=2



              it looks similar, but doesn't work...

              • 4. Re: Page parameters with seam 2.2.2
                antibrumm.mfrey0.bluewin.ch

                I see your problem.


                You are calling an action with your seam button. You just want a normal link with params. I think there is a viewid attribute instead of the action attribute.  This should generate the correct url.


                Greetings

                • 5. Re: Page parameters with seam 2.2.2
                  rzoller

                  Hey Martin,


                  you are totally right. It must look like this:



                  <s:button view="/fallbearbeiten/msp.xhtml"
                       value="Meilensteinplan bearbeiten (neu)"
                       rendered="#{not empty task.variables.get('fallID')}"
                       taskInstance="#{task}" propagation="none">
                       <f:param name="fallId" value="#{task.variables.get('fallID')}" />
                  </s:button>



                  with view and progagation.


                  Thank you for your Help!


                  René