Excellent hint, thanks. I forgot I may jump between various methods this way in the struts config. This will perfectly work in the case I described.
Any idea how to solve the problem with various messages or errors to be displayed, when I have no control on the messages/errors being added? Dariusz Wojtas On 12/30/06, Nick Tucker <[EMAIL PROTECTED]> wrote:
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.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]