struts - global exception - dynamic path attribute?

Hi

In my struts (1.2.9) application I have this scenario:

<global-exceptions>

<exception type="cannotLockRecordException" path="/error.jsp"/>

</global-exceptions>

<action-mappings>

<action ......>

loads of action mappings ...

</action-mappings>

For the global exception stated I want to keep users on the JSP they are on instead of sending them to the error page. Rather than putting an exception element inside each action mapping for this 1 exception is it possible to dynamically create the global exception path attribute value so that the user is forwarded back to the JSP they came from?

ie.

<global-exceptions>

<exception type="cannotLockRecordException" path="/wherever the user was before they called the action"/>

</global-exceptions>

I doubt this is achievable, just wanted to check with you Gurus since Im not very experienced.

Thanks

Jon

[1012 byte] By [Jonathan14a] at [2007-10-3 9:49:41]
# 1

Potentially you could use the request header "referer" to find the url a page came from. However that has issues.

In struts you can specify an "input" page within an action mapping.

This is the page that struts goes back to if validation of a form fails.

Surely you could do something similar to this?

Also you don't necessarily have to create an ActionForward in struts-config.xml. You can create them dynamically at runtime - that might be more appropriate in this case.

Hope this helps,

evnafets

evnafetsa at 2007-7-15 5:06:46 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...