Martin I think the docs you are looking at are for the old org.apache.struts2.config.Result rather than org.apache.struts2.convention.annotation.Result. Chris
-----Original Message----- From: musom...@aol.com To: user@struts.apache.org Sent: Thu, Aug 13, 2009 10:10 am Subject: Re: Validation does not work on redirect result But then look at http://struts.apache.org/2.1.6/docs/convention-plugin.html#ConventionPlugin-Resultannotation I am using location successfuly. C -----Original Message----- From: Martin Gainty <mgai...@hotmail.com> To: Struts Users Mailing List <user@struts.apache.org> Sent: Thu, Aug 13, 2009 9:34 am Subject: RE: Validation does not work on redirect result see value (of destination location) not location http://struts.apache.org/2.1.6/docs/result-annotation.html e.g. @Result(name="success", value="/home.page", type=TilesResult.class) is the doc incorrect? Martin Gainty ______________________________________________ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes=2 0pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement20 être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > To: user@struts.apache.org > Subject: Re: Validation does not work on redirect result > Date: Thu, 13 Aug 2009 08:18:56 -0400 > From: musom...@aol.com > > > Check > > > > @Result(name="input",value="findUser",type=ServletActionRedirectResult.class) > > > I think the attribute should be location rather than value in 2.1.x > Chris > > > > > > > > -----Original Message----- > From: spsarolkar <spsarol...@gmail.com> > To: user@struts.apache.org > Sent: Thu, Aug 13, 2009 12:47 am > Subject: RE: Validation does not work on redirect result > > > > > > > > > > > > FindUserAction extends UserAction which in turn extends from ActionSupport so > why add another import for ActionSupport so I directly used > > return SUCCESS; > > // > > Following does not work -- > @ParentPackage("base-package") > @Result(name="input",value="findUser",type=ServletActionRedirectResult.class) > public class FindUserAction extends UserAction implements > ServletRequestAware { > HttpServletRequest req uest; > public void setServletRequest(HttpServletRequest httpServletRequest) { > request=httpServletRequest; > } > public String execute(){ > if(user!=null) request.getSession().setAttribute("user",user); > return SUCCESS; > } > } > > Following works -- >=2 0 @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); > =2 > 0 return SUCCESS; > } > } > > > mgainty wrote: > > > > > > execute should return ActionSupport.SUCCESS; > > > > curious as to which document stated to use ServletRedirectAction for a > > result? > > Martin Gainty > > ______________________________________________ > > Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité > > > > Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene > > Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte > > Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht > > dient lediglich dem Austausch von Informationen und entfaltet keine > > r echtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von > > E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. > > Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le > > destinataire prévu, nous te demandons avec bonté que pour satisfaire > > informez l'expéditeur. N'importe quelle di ffusion non autorisée ou la > > copie de ceci est interdite. Ce message sert à l'information seulement et > > n'aura pas n'importe quel effet légalement obligatoire. Étant donné que > > les email peuvent facilement être sujets à la manipulation, nous ne > > pouvons accepter aucune responsabilité pour le contenu fourni. > > > > > > > > > >> Date: Wed, 12 Aug 2009 12:22:24 -0700 > >> From: spsarol...@gmail.com > >> To: user@struts.apache.org > >> Subject: Re: Validation does not work on redirect result > >> > >> > >> 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().setAttrib ute("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 > >> > Fr eemarker, 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, spsarolka > r <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(HttpServletReq uest > >> httpServletRequest) { > >> >> request=httpServletRequest; > >> >> } > >> >> public String execute(){ > >> >> if(user!=null) request.getSession().setAttribute("user",user); > >> >> return SUCCESS; > >> >> } > >> >> } > >> >> > >> >> Here is struts.xml > >> >> > >> >> <str uts> > >> >> <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-result > s> > >> >> <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 if20any > >> >> > >> >> 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 setServle tRequest(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 FindUs > erAction. > >> >> > > >> >> > 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 > >> > > > > _________________________________________________________________ > > Windows Live™: Keep your life in sync. > > http://windowslive.com/explore?ocid=PID23384::T:WLMTAGL:ON:WL:en-US:NF_BR_sync:082009 > > > > -- > View this message in context: > http://www.nabble.com/Validation-does-not-work-on-redirect-result-tp24939128p24948778.html > Sent from the Struts - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional c ommands, e-mail: user-h...@struts.apache.org > > > > > _________________________________________________________________ Get your vacation photos on your phone! http://windowsliveformobile.com/en-us/photos/default.aspx?&OCID=0809TL-HM=