tags:

views:

260

answers:

1

In my project I am using Struts 2 with Freemarker. How can I find last action's name from inside the template?

For example:
* I have one FTL file for adding and editing the object,
* I would like to be able to find last actions name eg. ${actionContext.actionName}.

Is there a way to do that?

A: 

I have manually rendered a lastAction hidden form field set to the current action's name. It is the current action during rendering, but will become the last (or previous) action on the next request when the form POSTs or GETs.

It's been useful for me to revert back to the last action when the current user action (which could be triggered from one of several previous actions) fails for some reason.

Abboq