Announcement Announcement Module
Collapse
No announcement yet.
Parameters in bean-actions Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Parameters in bean-actions

    Dear all,

    In one of my flows I am trying to do the following:


    Code:
         <swf:action-state id="actionName">
               <swf:bean-action bean="beanName" method="methodName">
                  <swf:method-arguments>
                     <swf:argument expression="conversationScope.arrayList[conversationScope.selectedIndex].attributeName"/>
                  </swf:method-arguments>
                  <swf:method-result name="resultName" scope="conversation"/>
               </swf:bean-action>
               <swf:transition on="success" to="viewState" />
        </swf:action-state>


    When I run this code the first time, it works perfectly! The object at the selected index "selectedIndex" is picked from an ArrayList "arrayList" and the value of the attribute "attributeName" is passed to the bean "beanName". The "selectedIndex" has bean put in the conversation scope earlier in the flow execution.

    After that, in my JSP, I click on a button and get back to my View-State, where in a transition, I am calling the same action-state again.

    This time though, I get a NoSuchPropertyException with a hint "java.util.ArrayList.0"!

    Does this have to do with the construct "conversationScope.arrayList[conversationScope.selectedIndex].attributeName" ?

    Thanks for your help!

  • #2
    Hi, based on your description this should work ok but it's difficult to say definitively without seeing more of the web flow definitions.

    Have you tried adding print statements at various points in your views to see what's going on? For example:

    ${conversationScope.selectedIndex}<br/>
    ${conversationScope.arrayList[conversationScope.selectedIndex]}<br/>
    ${conversationScope.arrayList[conversationScope.selectedIndex].attributeName}</br>

    rgrds,
    Ross

    Comment


    • #3
      My guess would be that the 'arrayList' in conversationScope is empty.

      Erwin

      Comment


      • #4
        I get the same exception.
        The reason was because my index was in the requestParameters scope and was not an integer but a String.

        You must insure that conversationScope.selectedIndex is an integer value and not a String.

        Comment


        • #5
          Good remark. Come to think of it, this is probably a side-effect of annoying nulling in OGNL, like described here:

          http://opensource.atlassian.com/proj...browse/SWF-275

          Erwin

          Comment

          Working...
          X