Hi,

we needed some more sophisticated redirection handling and I implemented it, 
based on ServletRedirectResult / ActionChainResult. I was asking if we are 
alone with our need for it. If not (say HERE loud and clearly :-), I will 
send it over...

In our application we have lots of edit->store->edit or edit->delete->overview 
action chains for various business entities. But there is a little problem 
with the chain result type, because when store.action chains go edit.action 
on succes, the current URL remains xyz/store.action. Not very pleasant for 
the lovers of browers reload / back button...

Alternative is to use a redirection, and, of course, there is a suitable 
result type redirect, but... it only takes complete http location as 
arguments and knows nothing about actions and namespaces. So if you define a 
package with its own namespace, say one namespace for each business entity, 
having nearly almost an edit, store, delete and overview action per 
namespace, it would be nice to configure the redirection just like you do 
when using chain.

So I implemented action handling for redirect result type triggered by the new 
parameter actionName, analog to the chain result type. When the actionName 
parameter is given, the namespace will be resolved (if staying in local 
namespace), and .action is appended to construct a valid url for redirection. 
If instead the old location parameter is set, nothing changes to former 
handling of redirection. To give an example:

<package name="gadget" extends="default" namespace="/gadget">

<action name="edit" class="de.aixcept.foo.GadgetActions" method="edit">
    <result name="success" type="dispatcher">
        <param name="location">/WEB-INF/jsp/gadget/edit.jsp</param>
    </result>
    <interceptor-ref name="defaultStack"/>
</action>

<action name="store" class="de.aixcept.foo.GadgetActions" method="store">
    <result name="error" type="dispatcher">
        <param name="location">/WEB-INF/jsp/gadget/edit.jsp</param>
    </result>
    <!-- Redirect to edit ection in same namespace on success -->
    <result name="success" type="redirect">
        <param name="actionName">edit</param>
    </result>
    <interceptor-ref name="defaultStack"/>
</action>

<action name="lookup" class="de.aixcept.foo.GadgetActions" method="lookup">
    <result name="success" type="redirect">
        <param name="location">http://www.gadgetfarm.org/lookup/</param>
    </result>
    <interceptor-ref name="defaultStack"/>
</action>

</package>

Anybody else needing it?

Regards,
- Rene

-- 
Rene Gielen  | http://www.aixcept.de/
Aachen       | PGP-ID: BECB785A
Germany      | gielen at aixcept.de



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to