You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by ja...@researchtogether.com on 2009/10/17 19:12:45 UTC

Redirect Action and wildcard methods

Hi,

I have the following actions set up:

       <action name="post*" class="com.mypack.PostAction" method="{1}">
             <result name="category">/WEB-INF/jsp/pages/PostCategory.jsp</result>
             <result name="topic">/WEB-INF/jsp/pages/PostTopic.jsp</result>
             <result name="display" type="redirectAction">displayCategory</result>
       </action>
       
       <action name="display*" class="com.mypack.DisplayAction" method="{1}">
             <result name="category">/WEB-INF/jsp/pages/DisplayCategory.jsp</result>
             <result name="topic">/WEB-INF/jsp/pages/Topic.jsp</result>
       </action>

In my post action I return "display" which should redirect to the action "displayCategory" which, by the way I have the display action set up should call the "Category" method in the DisplayAction class, but it doesn't. It calls the execute method.

I have tried setting up the redirectAction up in a coupld of ways, firstly as show above, but also using
<param name="actioniName">display</param>
<param name="method">Category</param>
using this method I get a java.lang.NoSuchMethodException: com.mypack.DisplayAction.!Category() the method *does* exist as I can browse to displayCategory and the behaviour is correct - is the .! part of the problem here?

and also <param name="actionName">displayCategory</param> does the same as the more complete action detailed above.

Can anyone provide any insight as to why it isn't working as I expect?

Cheers,
Jake aka _LisWork

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Redirect Action and wildcard methods

Posted by ja...@researchtogether.com.
Thanks for the reply, it does work as it should, but I made a silly mistake :(
Nothing like wasting a day!

Jake

On Sat, Oct 17, 2009 at 04:23:05PM -0700, Tommy Pham wrote:
> 
> 
> 
> ________________________________
> From: "jake@researchtogether.com" <ja...@researchtogether.com>
> To: user@struts.apache.org
> Sent: Sat, October 17, 2009 10:12:45 AM
> Subject: Redirect Action and wildcard methods
> 
> Hi,
> 
> I have the following actions set up:
> 
>        <action name="post*" class="com.mypack.PostAction" method="{1}">
>              <result name="category">/WEB-INF/jsp/pages/PostCategory.jsp</result>
>              <result name="topic">/WEB-INF/jsp/pages/PostTopic.jsp</result>
>              <result name="display" type="redirectAction">displayCategory</result>
>        </action>
>       
>        <action name="display*" class="com.mypack.DisplayAction" method="{1}">
>              <result name="category">/WEB-INF/jsp/pages/DisplayCategory.jsp</result>
>              <result name="topic">/WEB-INF/jsp/pages/Topic.jsp</result>
>        </action>
> 
> In my post action I return "display" which should redirect to the action "displayCategory" which, by the way I have the display action set up should call the "Category" method in the DisplayAction class, but it doesn't. It calls the execute method.
> 
> Tommy>>  I remember correctly from my reading, you need to return "category".  Have you gone through the bootstrap guide/tutorial?
> 
> I have tried setting up the redirectAction up in a coupld of ways, firstly as show above, but also using
> <param name="actioniName">display</param>
> <param name="method">Category</param>
> using this method I get a java.lang.NoSuchMethodException: com.mypack.DisplayAction.!Category() the method *does* exist as I can browse to displayCategory and the behaviour is correct - is the .! part of the problem here?
> 
> and also <param name="actionName">displayCategory</param> does the same as the more complete action detailed above.
> 
> Can anyone provide any insight as to why it isn't working as I expect?
> 
> Cheers,
> Jake aka _LisWork
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Redirect Action and wildcard methods

Posted by Tommy Pham <to...@yahoo.com>.


________________________________
From: "jake@researchtogether.com" <ja...@researchtogether.com>
To: user@struts.apache.org
Sent: Sat, October 17, 2009 10:12:45 AM
Subject: Redirect Action and wildcard methods

Hi,

I have the following actions set up:

       <action name="post*" class="com.mypack.PostAction" method="{1}">
             <result name="category">/WEB-INF/jsp/pages/PostCategory.jsp</result>
             <result name="topic">/WEB-INF/jsp/pages/PostTopic.jsp</result>
             <result name="display" type="redirectAction">displayCategory</result>
       </action>
      
       <action name="display*" class="com.mypack.DisplayAction" method="{1}">
             <result name="category">/WEB-INF/jsp/pages/DisplayCategory.jsp</result>
             <result name="topic">/WEB-INF/jsp/pages/Topic.jsp</result>
       </action>

In my post action I return "display" which should redirect to the action "displayCategory" which, by the way I have the display action set up should call the "Category" method in the DisplayAction class, but it doesn't. It calls the execute method.

Tommy>>  I remember correctly from my reading, you need to return "category".  Have you gone through the bootstrap guide/tutorial?

I have tried setting up the redirectAction up in a coupld of ways, firstly as show above, but also using
<param name="actioniName">display</param>
<param name="method">Category</param>
using this method I get a java.lang.NoSuchMethodException: com.mypack.DisplayAction.!Category() the method *does* exist as I can browse to displayCategory and the behaviour is correct - is the .! part of the problem here?

and also <param name="actionName">displayCategory</param> does the same as the more complete action detailed above.

Can anyone provide any insight as to why it isn't working as I expect?

Cheers,
Jake aka _LisWork

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org