Re: Validation does not work on redirect result
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 To: Struts Users Mailing List 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 > 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 f
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 To: Struts Users Mailing List 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 pas 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 > 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 request; > 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 > > 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 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 s
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 pas 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 facilement ê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 > 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 request; > public void setServletRequest(HttpServletRequest httpServletRequest) { > request=httpServletRequest; > } > public String execute(){ > if(user!=null) request.getSession().setAttribute("user",user); > return SUCCESS; > } > } > > Following works -- > @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 > > 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 pas 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 facilement être sujets à la manipulation, nous ne > > pouvons accepter aucune responsabilité pour le contenu fourni. > > > > > > > > > >> Date: Wed, 12
Re: Validation does not work on redirect result
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 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 request; public void setServletRequest(HttpServletRequest httpServletRequest) { request=httpServletRequest; } public String execute(){ if(user!=null) request.getSession().setAttribute("user",user); return SUCCESS; } } Following works -- @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 > 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 pas 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 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().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: >> > >> > > > method="doList"> >> > /struts/UserList.jsp >> > /struts/UserList.jsp >> > >> > >> > 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") >> > }) >> > >> >
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 request; public void setServletRequest(HttpServletRequest httpServletRequest) { request=httpServletRequest; } public String execute(){ if(user!=null) request.getSession().setAttribute("user",user); return SUCCESS; } } Following works -- @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; } } 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 > 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 pas 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 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().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: >> > >> > > > method="doList"> >> > /struts/UserList.jsp >> > /struts/UserList.jsp >> > >> > >> > 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 >> wrote: >> > >> >> >> >> thanks i missed that >> >> >> >> But i am not able to understand statement >> >> >> >> Here is my FindUser.action >> >> @ParentPackage("base-package") >> &g
RE: Validation does not work on redirect result
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 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 pas 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 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().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: > > > > > method="doList"> > > /struts/UserList.jsp > > /struts/UserList.jsp > > > > > > 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 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 > >> > >> > >> >> /> > >> > >> > >> > >> > >> >> class="org.xinus.interceptors.RedirectMessageInterceptor" /> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >>/WEB-INF/jsp/error.jsp > >> > >> > >> >> result="unknownError"/> > >> >> exception="org.hibernate.exception.ConstraintViolationException" > >> result="dupPK"/> > >> > >> > >>/WEB-INF/jsp/index.jsp > >> > >> > >> > >> > >> > >> > >> Whatever that statement means I got that I need to configure input result > >> for FindUser.action. Can you please help m
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().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: > >method="doList"> > /struts/UserList.jsp > /struts/UserList.jsp > > > 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 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 >> >> >>> /> >> >> >> >> >>> class="org.xinus.interceptors.RedirectMessageInterceptor" /> >> >> >> >> >> >> >> >> >> >>/WEB-INF/jsp/error.jsp >> >> >>> result="unknownError"/> >>> exception="org.hibernate.exception.ConstraintViolationException" >> result="dupPK"/> >> >> >>/WEB-INF/jsp/index.jsp >> >> >> >> >> >> >> 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
Re: Validation does not work on redirect result
> > 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 > > First thing you do is take a look at the struts-default.xml file http://struts.apache.org/2.1.6/docs/struts-defaultxml.html Search for 'workflow' and you will find this: This tells you the class="com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor" so you can then read the javadocs: http://struts.apache.org/2.1.6/struts2-core/apidocs/com/opensymphony/xwork2/interceptor/DefaultWorkflowInterceptor.html In a nutshell the workflow interceptor will cause the 'input' result to be returned if there has been any errors.
Re: Validation does not work on redirect result
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: /struts/UserList.jsp /struts/UserList.jsp 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 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 > > > /> > > > > > class="org.xinus.interceptors.RedirectMessageInterceptor" /> > > > > > > > > > >/WEB-INF/jsp/error.jsp > > > result="unknownError"/> > exception="org.hibernate.exception.ConstraintViolationException" > result="dupPK"/> > > >/WEB-INF/jsp/index.jsp > > > > > > > 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 > >
Re: Validation does not work on redirect result
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 /WEB-INF/jsp/error.jsp /WEB-INF/jsp/index.jsp 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
Re: Validation does not work on redirect result
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).
Re: Validation does not work on redirect result
va:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139) at org.mortbay.jetty.Server.handle(Server.java:313) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:830) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396) at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442) Here are the dependencies and their versions junit junit 3.8.1 test org.apache.struts struts2-core 2.0.11.2 org.apache.struts struts2-sitemesh-plugin 2.0.11.2 org.apache.struts struts2-spring-plugin 2.0.11.2 javax.servlet servlet-api 2.4 provided javax.servlet jsp-api 2.0 provided commons-fileupload commons-fileupload 1.1.1 uk.ltd.getahead dwr 1.1-beta-3 org.hibernate hibernate 3.2.1.ga org.hibernate hibernate-annotations 3.2.1.ga org.hibernate hibernate-entitymanager 3.2.1.ga mysql mysql-connector-java 3.1.14 javax.persistence persistence-api 1.0 javax.transaction jta 1.0.1B org.apache.struts struts2-codebehind-plugin 2.0.9 jmock jmock 1.0.1 test I have used suppressed warnings at class level like follows @SuppressWarnings({"ALL"}) public class RedirectMessageInterceptor extends MethodFilterInterceptor { ... ... ... .. .. . . } Greg Lindholm-2 wrote: > > Why do you think validation is not working? > Is it because you are not seeing error messages? > Error messages are not normally preserved across a redirect, if you would > like them to be you can add an interceptor to do this. > > See if this helps: > http://glindholm.wordpress.com/2008/07/02/preserving-messages-across-a-redirect-in-struts-2/ > > > On Wed, Aug 12, 2009 at 11:33 AM, spsarolkar wrote: > >> >> I am new to struts2 and just wrote one small program. >> I wanted to ask why Validation works for only dispatcher result and not >> redirect result. >> I want it with redirect result because it will allow bookmarking of page >> even when validation fails. >> -- >> View this message in context: >> http://www.nabble.com/Validation-does-not-work-on-redirect-result-tp24939128p24939128.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-tp24939128p24940700.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
Re: Validation does not work on redirect result
Why do you think validation is not working? Is it because you are not seeing error messages? Error messages are not normally preserved across a redirect, if you would like them to be you can add an interceptor to do this. See if this helps: http://glindholm.wordpress.com/2008/07/02/preserving-messages-across-a-redirect-in-struts-2/ On Wed, Aug 12, 2009 at 11:33 AM, spsarolkar wrote: > > I am new to struts2 and just wrote one small program. > I wanted to ask why Validation works for only dispatcher result and not > redirect result. > I want it with redirect result because it will allow bookmarking of page > even when validation fails. > -- > View this message in context: > http://www.nabble.com/Validation-does-not-work-on-redirect-result-tp24939128p24939128.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 > >
Validation does not work on redirect result
I am new to struts2 and just wrote one small program. I wanted to ask why Validation works for only dispatcher result and not redirect result. I want it with redirect result because it will allow bookmarking of page even when validation fails. -- View this message in context: http://www.nabble.com/Validation-does-not-work-on-redirect-result-tp24939128p24939128.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