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:
>> > 
>> >     <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
>> 
> 
> _________________________________________________________________
> 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 commands, e-mail: user-h...@struts.apache.org

Reply via email to