Genius, I love you guys!

So in my Login form I now have an attribute called 'success' that passes the 
URI into the Login Action, which then automatically redirects the View for 
me!

Very very elegant. Horray for WebWork!


>From: "Matt Baldree" <[EMAIL PROTECTED]>
>To: "Taavi Tiirik" <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
>CC: <[EMAIL PROTECTED]>
>Subject: Re: [Webwork-user] redirect view at runtime
>Date: Mon, 4 Mar 2002 06:51:55 -0600
>
>You can also return any string from your action's execute that the
>dispatcher will use as a key to fetch a URI from the request object. If the
>dispatcher does not find an object from the request with this key it will
>then try and find a view from your view map.
>
>-Matt
>
>----- Original Message -----
>From: "Taavi Tiirik" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Cc: <[EMAIL PROTECTED]>
>Sent: Monday, March 04, 2002 5:11 AM
>Subject: Re: [Webwork-user] redirect view at runtime
>
>
> > Toby,
> >
> > > So I need to take the referrer of the login page (which traditionally 
>I
> > just
> > > place in a hidden variable in the Login form) and then when login is
> > > complete I need to set the view to the redirect string, rather than 
>the
> > view
> > > assigned in actions.xml. Is there an easy way to do this within the
>Action
> > > API?
> >
> > There is an easy way of doing this by configuring security constraints 
>and
> > form based login config in your web.xml. See security related examples
> > provided by your servlet container.
> >
> > If you want to do it by yourself then:
> >
> > You can remember the actual page the user wanted to see by storing
> > request URI into session variable. For example:
> >
> > session.put( "auth_requestURI", getServletRequest().getRequestURI() );
> >
> > Once you have completed your login procedure you can forward
> > your user to desired page like this:
> >
> > HttpServletRequest request = getServletRequest();
> >
> > request.getRequestDispatcher( requestURI ).forward( request,
> > getServletResponse() );
> >
> > PS! Make sure that requestURI does not contain context path and does not
> > begin with
> > '/' when forwarding to another page.
> >
> > But there is hardly any point in doing it by yourself.
> >
> > with best wishes,
> > Taavi
> >
> >
> > _______________________________________________
> > Webwork-user mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/webwork-user
> >
> >
>
>


_________________________________________________________________
Join the world�s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


_______________________________________________
Webwork-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webwork-user

Reply via email to