Don Brown wrote:
In both cases, you want to separate the selection of the result from the
Action. Currently, the action would have to determine, say, if the
browser is IE and return "success-ie". A better solution would be to
let the Action focus on what it does, returning "success", then let a
Result Selector determine which "success" result to process. For
example, the config might look like this:
<action name="ViewFoo" class="mypackage.ViewFooAction">
<result name="success" when="modern-browser">foo.jsp</result>
<result name="success" when="netscape4">foo-ns4.jsp</result>
</action>
Or in the second case:
<action name="ViewFoo" class="mypackage.ViewFooAction">
<result name="success" when="html">foo.jsp</result>
<result name="success" when="html-partial">foo-partial.jsp</result>
<result name="success" when="json" type="json" />
<result name="success" when="xml" type="xml" />
</action>
I definitely like the idea.
The first thing I noticed in this example is that there appears to be a
missing configuration section. Is it safe to assume that in order to
achieve extensibility you're thinking that selectors would be configured
something like:
<result-selector name="html,html-partial,json,xml"
class="o.a.s.dispatcher.ContentTypeResultSelector/>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]