struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ana Narvaez Vila" <ana.narv...@sema.es>
Subject Re: simple forward/redirect
Date Tue, 06 Mar 2001 10:54:40 GMT
You could define a 'general' ForwardAction that simply makes the forward
in its perform.
Something like this.

public ActionForward perform(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) 
throws ServletMaravediNetException {

	return (mapping.findForward("success"));

}

This class could be com.yourcompany.yourpackage.ForwardAction and you
could use it everytime that you want to do a simply forward or redirect.

     <!-- Process a user logon -->
     <action    path="/logon"
                type="com.yourcompany.yourpackage.ForwardAction"
         <forward name="success" path="/logon.jsp" />
     </action>

     <action    path="/anotheraction"
                type="com.yourcompany.yourpackage.ForwardAction"
         <forward name="success" path="/other.jsp" redirect="true"/>
     </action>

Matthias Bauer wrote:
> 
> Hi everybody!
> 
> There was a discussion about not calling jsp pages directly, but to always go
> through an action instead. I agree that this makes a lot of sense it quite a few
> cases.
> 
> Now my stupid question is: What do I have to enter in struts-config.xml in order
> to do a simple forward or redirect e. g. from logon.do to logon.jsp?
> 
> Normally I would write something like this:
> 
> >     <!-- Process a user logon -->
> >     <action    path="/logon"
> >                type="login.LogonAction"
> >         <forward name="success" path="/logon.jsp" />
> >     </action>
> 
> But I don't need to do something special in the action LogonAction before
> diplaying logon.jsp. So how do I come around this? Write a dummy action which
> always returns success and use it in each of these cases?
> 
> Thanks a lot,
> 
>   --- Matthias
------------------------------------------------------------------
This email is confidential and intended solely for the use of the individual to whom it is
addressed. Any views or opinions presented are solely those of the author and do not necessarily
represent those of Sema Group. 
If you are not the intended recipient, be advised that you have received this email in error
and that any use, dissemination, forwarding, printing, or copying of this email is strictly
prohibited.
------------------------------------------------------------------


Mime
View raw message