4 Replies Latest reply on Oct 14, 2007 9:47 PM by steve tynor

    s:button action cannot resolve el expression

    steve tynor Novice

      Seam 2.0.0.CR1

      I'm flumoxed. I have a simple rich:dataTable that contains some items. I can happily print property values of the items, and even use s:link to dynamically invoke a view based on an object properly:

      (this works):

      <rich:dataTable id="pendingItems"
       value="#{dashboard.pendingItems}" >
       <h:column id="action">
       <f:facet name="header">Item</f:facet>
       value="Edit..." view="#{item.editorView}">
       <f:param name="itemId" value="#{item.itemId}" />

      (the following, however, prints the item property as the value of the button name (demonstrating that item is definitely defined), but when I click on the button, I get
      javax.el.PropertyNotFoundException with message: "Target Unreachable, identifier 'item' resolved to null"

       <s:button value="Do Something to #{item.name}" action="#{item.doSomething}">
       <f:param name="itemId" value="#{item.itemId}" />

      Perhaps the "item" object is in the wrong context (page vs. conversation?). How can I cope?


        • 1. Re: s:button action cannot resolve el expression
          Pete Muir Master

          item isn't available when the jsf tree is recontructed in the restoreview phase. Try with h:commandLink (which causes the view to be reconstructed, and so the item variable should be available). Let us know whether that works :)

          • 2. Re: s:button action cannot resolve el expression
            steve tynor Novice

            Thanks Pete. That gets me closer -- I now invoke the proper action on the backing bean.

            I left out a bit of detail in my original query - and that detail is still causing probs. My backing bean has a "getHomeComponent()" function that does a Component.getComponent() on the proper EntityHome class - that's where my action method actually lives. The action method is being called on the a proper Home object, but h:commandButton is not interacting well with my page params, so the setFooFooId() function is never getting called - and I end up instantiating a new object with each action. Is there a way to get s:button style page parameter behavior with an h:commandButton?

             <h:commandButton value="Undelete"
             <f:param name="clientClientId" value="#{item.clientId}" />

            (Thanks again Pete - do you ever sleep?)

            • 3. Re: s:button action cannot resolve el expression
              Daniel Hinojosa Master

              in jsf, <f:param> puts the parameter in the request, and doesn't (I believe) set the values to the component the way seam does in pages.xml.

              There are a lot of ways to skin this cat though...but from what you are doing it looks like you will fare better with @DataModel @DataModelSelection solution.

              • 4. Re: s:button action cannot resolve el expression
                steve tynor Novice

                Thanks dhinojosa,

                That pushed me in the right direction - I've refactored my code to use @DataModel/@DataModelSelection and all is working fine.

                Thanks to both of you for your help.