You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Eduardo Yáñez Parareda <ed...@gmail.com> on 2008/02/18 14:43:08 UTC

How to come back to previous action?

Hello,

How could I come back to an action I executed before?
i.e.:

User is in screen 1, then click the button search and some results are shown
to her. She dbclick in a result item
and it's shown the item's detail in screen 2. Then she wants to go back to
screen 1.... how must I implement the
 'go back' action in order to execute the same action she did before?

Re: How to come back to previous action?

Posted by Eduardo Yáñez Parareda <ed...@gmail.com>.
>
>
> You might want to include a Marker interface so that you don't collect all
> the data from every request.  If you have a BackAware interface (or
> BackTarget, or something else meaningful).


That's a good idea, but our app. saves the state depending on where you come
from,
not depending on where you go to. I mean, if user dblclick from screen 1 to
go to scr2, then
state will be saved to allow user to go back, but if you go to scr2 from the
menu, the state won't be saved.

Re: How to come back to previous action?

Posted by Chris Pratt <th...@gmail.com>.
On Feb 18, 2008 7:41 AM, Eduardo Yáñez Parareda <ed...@gmail.com>
wrote:

> The solution I'm going for is to implement a Filter or Interceptor which
> manages a stack of requests. I'll push the action and the request
> attributes
> in the stack, so when I have to go back, I can pop from the stack the
> action
> and attributes needed to make the same search as before.
> When user click another menu option, the filter must empty the stack and
> push the new action in it.
>


You might want to include a Marker interface so that you don't collect all
the data from every request.  If you have a BackAware interface (or
BackTarget, or something else meaningful).  Then your interceptor can check
whether the Action implements BackAware and only then save the state.  That
should prevent you from saving a bunch of unnecessary data.
  (*Chris*)

Re: How to come back to previous action?

Posted by Wes Wannemacher <we...@wantii.com>.
Eduardo, 

You might want to take a look at the breadcrumb plugin. It's basic
functionality is to create a breadcrumb trail like many popular sites on
the 'net.

http://cwiki.apache.org/S2PLUGINS/breadcrumbs-plugin.html

It may not be exactly what you're looking for, but it will provide a
good example.

-Wes

On Mon, 2008-02-18 at 16:41 +0100, Eduardo Yáñez Parareda wrote:
> The solution I'm going for is to implement a Filter or Interceptor which
> manages a stack of requests. I'll push the action and the request attributes
> in the stack, so when I have to go back, I can pop from the stack the action
> and attributes needed to make the same search as before.
> When user click another menu option, the filter must empty the stack and
> push the new action in it.


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


Re: How to come back to previous action?

Posted by Eduardo Yáñez Parareda <ed...@gmail.com>.
The solution I'm going for is to implement a Filter or Interceptor which
manages a stack of requests. I'll push the action and the request attributes
in the stack, so when I have to go back, I can pop from the stack the action
and attributes needed to make the same search as before.
When user click another menu option, the filter must empty the stack and
push the new action in it.

Re: How to come back to previous action?

Posted by Laurie Harper <la...@holoweb.net>.
There's nothing specifically built in to handle that, and the exact 
approach would depend on how your application is structured. However, 
the general idea would be to record the user's location in the app at 
the point you want to return them to.

If the 'go back' action is meant to take them back to their search 
results page, you'd just need to record the search term(s); if it should 
take them back to where they were when they initiated the search, you 
would probably need a more pervasive mechanism to always record the 
user's location at each page from which a search could occur. If that 
includes pages resulting from form submissions, you may need to 
additionally record the set of state data (form inputs, etc.) that would 
be required to re-generate that page.

Essentially, you need to identify the (set of) return points you want to 
support; then from that determine what data you need to record in order 
to do that.

L.

Eduardo Yáñez Parareda wrote:
> I forgot to say that what I'm asking for is a Struts2 way to do that, a
> pattern, or a tool that S2 provides which could
> help me to do it.
> 
> On 18/02/2008, Eduardo Yáñez Parareda <ed...@gmail.com> wrote:
>> Hello,
>>
>> How could I come back to an action I executed before?
>> i.e.:
>>
>> User is in screen 1, then click the button search and some results are
>> shown to her. She dbclick in a result item
>> and it's shown the item's detail in screen 2. Then she wants to go back to
>> screen 1.... how must I implement the
>>  'go back' action in order to execute the same action she did before?
>>
>>
>>
> 



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


Re: How to come back to previous action?

Posted by Eduardo Yáñez Parareda <ed...@gmail.com>.
I forgot to say that what I'm asking for is a Struts2 way to do that, a
pattern, or a tool that S2 provides which could
help me to do it.

On 18/02/2008, Eduardo Yáñez Parareda <ed...@gmail.com> wrote:
>
> Hello,
>
> How could I come back to an action I executed before?
> i.e.:
>
> User is in screen 1, then click the button search and some results are
> shown to her. She dbclick in a result item
> and it's shown the item's detail in screen 2. Then she wants to go back to
> screen 1.... how must I implement the
>  'go back' action in order to execute the same action she did before?
>
>
>