2 Replies Latest reply on Nov 9, 2006 11:05 PM by iradix

    s:link cannot understand Facelets params?

    bfo81

      Yes, I'm back *g*.

      Simplified scenario: I'm using a template for data tables listing entities with an edit link at the end of each row. The concrete list entries and the editor bean are put into the template via ui-params.

      The list template:

      <h:dataTable var="entry" value="#{list.entries}">
      
       <ui:insert name="content" />
      
       <h:column>
       <s:link action="#{editor.edit}" value="Edit this">
       <f:param name="id" value="#{entry.id}" />
       </s:link>
       </h:column>
      
       </h:dataTable>


      And a concrete "content" example, that gets decorated with the above code:

      <ui:param name="editor" value="#{personEditorBean}" />
      <ui:param name="liste" value="#{personListBean}" />
      
      <ui:define name="content">
      
       ...other columns...
      
      </ui:define>


      If I use h:commandLink instead of s:link, everything works fine.
      But s:link is not able to understand that #{editor.edit} means (in this case) #{personEditorBean.edit}.

      Caused by: javax.faces.el.PropertyNotFoundException: Base is null: editor



      wtf? ^^

        • 1. Re: s:link cannot understand Facelets params?
          bfo81

          Hm... maybe the problem is caused by something else. I found another exception some lines above in the log.

          java.lang.StringIndexOutOfBoundsException: String index out of range: -1
           at java.lang.String.substring(String.java:1768)
           at org.jboss.seam.jsf.AbstractSeamPhaseListener.selectDataModelRow(AbstractSeamPhaseListener.java:86)
          I must say that I do not use a @DataModel, and so the dataModelSelection parameter in the URL after clicking a s:link is empty.

          (Yes, I do have a reason for not using @DataModel: When having an outdated list page, then clicking a link may result in a different entry to be displayed.)

          So, any experiences or ideas with this issue?

          • 2. Re: s:link cannot understand Facelets params?
            iradix

            You may want to try accessing the bean you pass into your template using the #{editor[edit]} type notation instead. This is a shot in the dark because I haven't tried it but I've seen it suggested for this type of use elsewhere.

            I figured I'd also point out that your outdated list issue can be solved by beginning a conversation on your list page, outjecting the DataModel to the conversation and using a @Conversational annotation on your selection method. I take it some people aren't crazy about conversation scoped DataModels but they sure make paging and sorting easy.