Hi 
  If you are always going to display the same message then you could get the
action you redirect 
to to display the message. I have done this to get "Processing Successful"
messages output after
updates
  e.g.
     in your action:-
        return "missingid";

     redirect this result to a method in your other action
     <result name="missingid" type="redirect-action">input!noId</result>

     and in the method output your message before doing your normal
processing

     public String noId() {
         addActionError(getText("some.id.not.set"));
         return execute();
     }

N
 

Dariusz Wojtas wrote:
> 
> Hi,
> 
> I have some action  [/namespace/edit.action] which cannot be called
> without ID.
> In fact the ID parameter is needed under some conditions.
> 
> Therefore if I do not have ID when it is needed I add error message
> and redirect to INPUT:
> 
>     addActionError(getText("some.id.not.set"));
>     return INPUT
> 
> How do I define my action to redirect to another action (not a JSP)
> AND keep the message so it can be displayed?
> I tried to configure my result in different ways
> 
> a) try result type 'chain' - pointing to another action name in the
> same package (does not need any params)
>         <action name="edit" class="package.MyAction" method="edit">
>             <result>/WEB-INF/jsp/pages/package/input.jsp</result>
>             <result name="input" type="chain">index</result>
>         </action>
> 
> b) I tried result type 'redirect', 'redirect-action'
>     but then I loose my error message
> 
> c) I tried 'dispatcher' to a fully qualified action URL
>             <result name="input"
> type="dispatcher">/package/index.action</result>
>     but then I get exception from Tomcat:
> 
>     HTTP Status 404 - /<appPrefix>/package/index.action
>     The requested resource (/<appPrefix>/package/index.action) is not
> available.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--Redirecting-to-another-action-with-preserving-error-messages-tf2890519.html#a8093685
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to