0

I am building struts2 parameters values from variables and in one case it works and in the other it doesn't. Here is the 'result' from a menu item click :

<result name="WidgetList"  type="redirectAction">            
    <param name="actionName">actList</param>
    <param name="object">Widget</param>
</result>

And the Action mapping :

<action name="actList" class="MyClass" method="execute">
    <interceptor-ref name="newStack" />
    <result name="success">
        <param name="location">jsp + ${object} + List.jsp</param>
    </result>
    <result name="Edit" type="redirectAction">            
        <param name="actionName">actEdit + ${object}</param>
    </result>
</action>

In the 'Edit' result (which is returned after the user clicks a Widget in the list) the actionName is built correctly and that action runs to display a page.

actEdit + ${object}

becomes :

actEditWidget

However the menu click that redirects to 'actList' does NOT get build correctly, even though the ${object} parameter is correctly replaced.

jsp + ${object} + List.jsp

becomes the string :

"jsp+Widget+List.jsp"

And I get :

HTTP Status 404 - /MyApp/jsp+Widget+List.jsp

Why does this work in one case and not the other... and how can I 'fix' this?

Roman C
  • 49,761
  • 33
  • 66
  • 176
user3708842
  • 543
  • 8
  • 23

1 Answers1

0

Dave is right - just squishing it together does work, although it looks really ugly.

jsp${object}List.jsp

I'm still curious to know WHY there is a difference, but for some reason the "location" param above respects every character in the param value. However the "actionName" param strips internal spaces and reads both + and || as concatenations. So this works :

a    ||    c    tEdi + t${object}   

Makes no sense to me but at least I can do what I wanted to.

Thanks Dave!

user3708842
  • 543
  • 8
  • 23