3 Replies Latest reply on Dec 11, 2006 4:43 PM by Stan Silvert

    Parameter in EL in a POJO env

    Eduardo Murai Newbie

      I have faced a problem when passing parameters to a method using EL in a POJO environment (non-EJB and non-hibernate). I have setup the SeamFaceletViewHandler in faces-config.xml, as well.

      Here is the xhtml sample :

      <h:dataTable value="#{fruitList}" var="fr">

      <h:column>
      <f:facet name="header">
      <f:verbatim>Description</f:verbatim>
      </f:facet>

      (1) <s:link value="#{fr.name}" action="#{fruitBasket.select(fr.id)}"/>

      (2) <s:link value="#{fr.name}" action="#{fruitBasket.select(fr)}"/>
      </h:column>
      </h:dataTable>

      In case (1) the fr.id is not interpreted by EL and stays as "fr.is" in the rendered HTML!

      In case (2) I do not receive any error, but the object Fruit related to variable fr, is not passed.

      Looking at Hibernate sample I got the alternative using @DataModelSelectionIndex, but I would like to understand why the code above does not work since this simple approach may not be suitable in complex interations when I need to pass more than the "index".

      I am evaluating Seam to be used in a project.

      Eddy

        • 1. Re: Parameter in EL in a POJO env
          Gavin King Master

          fr is a temporary variable that exists while rendering the JSF page. The "location" in the list cannot be "remembered" If you want it to be available across a new request to the server, you need to wrap the list in a DataModel, which does have a mechanism for remembering the position.

          • 2. Re: Parameter in EL in a POJO env
            Eduardo Murai Newbie

            Hi Gavin, thanks for answering.

            Your answer fits well on case (2) but how about the case (1) ? "fr.id" shoud be interpreted to "fr.getId()" and get the "number" in the rendered html or am I missing something ?

            cheers.

            Eddy

            • 3. Re: Parameter in EL in a POJO env
              Stan Silvert Master

               

              "esoares" wrote:
              Hi Gavin, thanks for answering.

              Your answer fits well on case (2) but how about the case (1) ? "fr.id" shoud be interpreted to "fr.getId()" and get the "number" in the rendered html or am I missing something ?

              cheers.

              Eddy



              Same answer. The Method Params feature currently does not support EL variables such as "fr". Because this is a page-level variable it is not remembered during the deferred evaluation of the expression.

              Stan