4 Replies Latest reply on May 9, 2007 1:59 PM by Sergio Sanchez

    EL enhancements in Seam 1.2.1

    Sergio Sanchez Newbie

      Hi :) Does EL enhancements work in Seam 1.2.1? Because i'm trying to make this code work:
      The XHTML file:

      <h:dataTable id="projectPlanList" var="pp"
       rendered="#{not empty projectPlanList.resultList}">
       <f:facet name="header">Id</f:facet>
       <f:facet name="header">Name</f:facet>
       <s:link id="pp" value="#{pp.name}" action="#{projectPlanHome.edit(pp.id)}"/>

      And the code of the JavaBean
      public String edit(Long id){
       projectPlanId = id;
       return "/project-plan.xhtml";

      I'm debugging it, but inside the method the id variable always is null. Am I missing something? Thanks :)

        • 1. Re: EL enhancements in Seam 1.2.1
          Christian Bauer Master

          This is not how doStuff(argument) works. What you are trying to do is a common error.

          Think about when #{projectPlanHome.edit(pp.id)} will be evaluated: During rendering of the page. However, if you check the source of the rendered HTML, you will see that pp.id has not been replaced with a value, it is still pp.id. So when you click the link, Seam will on the server call your projectPlanHome.edit() method and it will resolve "pp.id" as an argument to that method. At that time, "pp" is long gone.

          What you want is @DataModelSelection, see the Seam documentation and examples.

          • 2. Re: EL enhancements in Seam 1.2.1
            Christian Bauer Master

            In other words, and as the documentation says, what you just wrote is equivalent to this:

            Long projectPlanId;
            public String edit() {

            That also doesn't work because at call time of edit(), no #{pp.id} can be resolved - pp is just the loop variable that is used during rendering of the previous page.

            • 3. Re: EL enhancements in Seam 1.2.1
              Sergio Sanchez Newbie

              Thanks! Let me ask you another question related to the last one:
              What about if I don't have a dataTable? In other pages I have links like this one:

              <s:link id="ppPhase" value="#{projectPlan.phases['i'].name}" view="/phase.xhtml" propagation="nest">
               <f:param name="phaseId" value="#{projectPlan.phases['i'].id}"/>

              which is trying to access other page with the information of an existing entityBean.
              I achieved this using "seam-gen new-entity" and all my pages are RESTful, but I'd like them to beheave with an "action" behaviour (or push-style). How can I do that? Can I keep the EntityHomes and tranform them to be push-style?
              Thanks for your time.

              • 4. Re: EL enhancements in Seam 1.2.1
                Sergio Sanchez Newbie

                I've already tried what i was planning to do, and yeah, it works! Now, I understand the previous posts. It's needed an object in the scope of the conversation in order to evaluate the argument of the expression.
                Thanks! All of you, the staff of JBoss are very helpful.