You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Darren Hill <dh...@724.com> on 2002/11/05 20:18:03 UTC

Previous Action

I have an action which needs to know which action called it.

More background ... its a deleteAction that, if called from a list, go back
to that list, if called from a view, go to welcome page, etc

1)  Can I discover which action was call, from within an action?
2)  Is there a better way to do this?

Darren.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Previous Action

Posted by Eddie Bush <ek...@swbell.net>.
Ok - here's a dead-simple approach:

    - your form has a field indicating which action you're going through 
(list / detail)
    - your form has a hidden field which carries this value to ...
    - your delete action which has a forward for each possible value and 
uses the value of the parameter to lookup the forward it returns.

Is that too simplistic?

Darren Hill wrote:

>I have an action which needs to know which action called it.
>
>More background ... its a deleteAction that, if called from a list, go back
>to that list, if called from a view, go to welcome page, etc
>
>1)  Can I discover which action was call, from within an action?
>2)  Is there a better way to do this?
>
>Darren.
>

-- 
Eddie Bush





--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Previous Action

Posted by Robert Taylor <rt...@mulework.com>.
Darren, you can create different action mappings which identify the correct
"return to" screen but map to the same action. If I'm on the list page and I
would invoke something like /do/list/delete and if I was on a view, then
invoke the delete action like /do/view/delete. The action mapping for
/list/delete would have a success forward which returned me to the list
where as the /view/delete action mapping would have a success forward which
returned me to the welcome page.

You could also use the request header "REFERER", but that is not reliable.

robert

> -----Original Message-----
> From: Darren Hill [mailto:dhill@724.com]
> Sent: Tuesday, November 05, 2002 2:18 PM
> To: 'Struts Users Mailing List'
> Subject: Previous Action
>
>
> I have an action which needs to know which action called it.
>
> More background ... its a deleteAction that, if called from a
> list, go back
> to that list, if called from a view, go to welcome page, etc
>
> 1)  Can I discover which action was call, from within an action?
> 2)  Is there a better way to do this?
>
> Darren.
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>