Thursday, May 3, 2007

WebWork Result Types

Besides the default result type "dispatcher", there are some common result types:
1. redirect
Important for those create actions, reload confirmation page may result in re-create sth if URL stick to the previous create action. Parameter can be passed in by value in stack. e.g,
.. type="redirect">listBundles.action?archiveFilename=${archiveFilename}

2. chain
Action chaining is different from dispatching to another action in that:
- In same ActionInvocation
- Copy common properties from most recent action
In both cases, every action executed is pushed onto stack since they run in same thread/request.

3. StreamResult
For download file. BTW, use setTimeout() on init() to both refresh a page and download a file sounds a better solution than using refresh metatag which causes 'back' button problem.

We may even create customized ResultType such as JSON for AJAX call.

No comments: