Yep its working wonderfully, I shouldn't have made use of ServletRedirectAction. Following worked for me
@ParentPackage("base-package") @Result(name="input",value="/WEB-INF/jsp/user/findUser-success.jsp") public class FindUserAction extends UserAction implements ServletRequestAware { HttpServletRequest request; public void setServletRequest(HttpServletRequest httpServletRequest) { request=httpServletRequest; } public String execute(){ if(user!=null) request.getSession().setAttribute("user",user); return SUCCESS; } } Greg Lindholm-2 wrote: > > You are going to want to define at least the 2 results 'success' and > 'input' > for FindUserAction. > The 'input' result should not be a redirect, it should be to a jsp (or > Freemarker, or velocity, etc). > > Here is an example from my app using struts.xml configuration: > > <action name="UserList" class="my.xxx.struts.UserListAction" > method="doList"> > <result>/struts/UserList.jsp</result> > <result name="input">/struts/UserList.jsp</result> > </action> > > I don't use annotations to define results but I think it would look like > this: > > @Results({ > @Result (name="success", location="/struts/User/List.jsp"), > @Result (name="input", location="/struts/User/List.jsp") > }) > > > On Wed, Aug 12, 2009 at 1:48 PM, spsarolkar <spsarol...@gmail.com> wrote: > >> >> thanks i missed that >> >> But i am not able to understand statement >> >> Here is my FindUser.action >> @ParentPackage("base-package") >> public class FindUserAction extends UserAction implements >> ServletRequestAware { >> HttpServletRequest request; >> public void setServletRequest(HttpServletRequest httpServletRequest) { >> request=httpServletRequest; >> } >> public String execute(){ >> if(user!=null) request.getSession().setAttribute("user",user); >> return SUCCESS; >> } >> } >> >> Here is struts.xml >> >> <struts> >> <constant name="struts.codebehind.defaultPackage" value="base-package" >> /> >> <constant name="struts.codebehind.pathPrefix" value="/WEB-INF/jsp/"/> >> >> <package name="base-package" extends="struts-default"> >> <interceptors> >> <interceptor name="redirectMessage" >> class="org.xinus.interceptors.RedirectMessageInterceptor" /> >> <interceptor-stack name="myStack"> >> <interceptor-ref name="redirectMessage" /> >> <interceptor-ref name="paramsPrepareParamsStack" /> >> </interceptor-stack> >> </interceptors> >> >> <default-interceptor-ref name="myStack" /> >> >> <global-results> >> <result name="unknownError">/WEB-INF/jsp/error.jsp</result> >> </global-results> >> <global-exception-mappings> >> <exception-mapping exception="java.lang.Exception" >> result="unknownError"/> >> <exception-mapping >> exception="org.hibernate.exception.ConstraintViolationException" >> result="dupPK"/> >> </global-exception-mappings> >> <action name="index" class="org.xinus.actions.BaseAction"> >> <result name="success">/WEB-INF/jsp/index.jsp</result> >> </action> >> </package> >> <!--<package name="myPackage" extends="struts-default"> >> <action name="index" class="org.xinus.IndexAction"> >> <result>/jsp/index.jsp</result> >> </action> >> <action name="helloWorld" class="helloWorldAction"> >> <result name="input">/jsp/index.jsp</result> >> <result>/jsp/helloWorld.jsp</result> >> </action> >> </package>--> >> </struts> >> >> >> Whatever that statement means I got that I need to configure input result >> for FindUser.action. Can you please help me understand what is workflow >> interceptor doing here. I know about workflow interceptor as it is >> responsible for calling validate method on action if action implements >> ValidationAware interface and collecting errors if any >> >> maybe I should point result like this >> @ParentPackage("base-package") >> >> @Result(name="input",value="findUser",type=ServletActionRedirectResult.class) >> public class FindUserAction extends UserAction implements >> ServletRequestAware { >> HttpServletRequest request; >> public void setServletRequest(HttpServletRequest httpServletRequest) { >> request=httpServletRequest; >> } >> public String execute(){ >> if(user!=null) request.getSession().setAttribute("user",user); >> return SUCCESS; >> } >> } >> >> >> >> Greg Lindholm-2 wrote: >> > >> > No result defined for action org.xinus.actions.user.FindUserAction and >> >> result input at >> >> >> > >> > From the write up at: >> > >> http://glindholm.wordpress.com/2008/07/02/preserving-messages-across-a-redirect-in-struts-2/ >> > >> > The one thing you need to be aware of is: The action you are >> redirecting >> > towards will need to configure a result with name=”input” as the added >> > messages will trigger the ‘workflow’ interceptor to return a result of >> > “input”. >> > >> > You need to configure a result of 'input' for action FindUserAction. >> > >> > If you don't know what this means then post your struts configuration >> > (struts.xml). >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/Validation-does-not-work-on-redirect-result-tp24939128p24941557.html >> Sent from the Struts - User mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> > > -- View this message in context: http://www.nabble.com/Validation-does-not-work-on-redirect-result-tp24939128p24943001.html Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org