struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kishore Senji <kse...@gmail.com>
Subject Re: Action Returning to previous page
Date Thu, 20 Jan 2005 06:35:11 GMT
On Wed, 19 Jan 2005 22:57:01 -0500, Brandon Mercer <brandon@eutonian.com> wrote:
> Will Stranathan wrote:
> 
> > Not positive I completely understand the question, so I'll make a very
> > vague response.
> 
> Yeah, after I read it I didn't make much sense to myself either.  :-P
> 
> >
> > You can:
> > 1) Use the input attribute of an Action to specify the page that fed
> > it - if the validate() method on the ActionForm() returns a non-empty
> > ActionErrors, the user will go back there.
> 
> This sounds pretty good to me.  Would I be breaking any unwritten rules
> if I used that to return the user to the page from which they came even
> if there weren't errors?
> 
> > 2) Specify a <forward /> for the Action that sends the user back to
> > from whence they came.
> 
> I don't think I can do this because they may come from a number of pages.
> 

If I understand you correctly, you want to build something similar to this:

In Yahoo, for eg: If you want to access something restricted only for
users, Yahoo takes the user to the login page and after successful
login, Yahoo drops back on the page the user was on.

You cannot do this with input or a forward. As you said the action
(for eg: the LoginAction in the Yahoo eg) can be called from any page.

So, the solution is to send the url that you want to return to after
finishing the action, as a "request" variable and send the user to
where the request variable points to after successful action
completion

> > 3) Use request.getHeader("referer") to find out the page that got you
> > here.  But you need to be careful - it's NOT mandatory for a client to
> > send this header.  And you won't be able (AFAIK) to return a proper
> > ActionForward for it - you'll just have to redirect the request and
> > return null.
> 
> I guess it might make more sense if I created an example.  You click on
> a link to an item in a store or something online.  That link you click
> on points to the exact page or some such, but when you go to get into
> that page it has a little thing that checks to see if you're logged in.
> If you're not logged in it redirects you to the login page.  Once you
> log in it takes you directly to the page you were trying to reach,
> whatever it may have been.  Does that help?
> Brandon
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message