Intro
I am rendering a chart to the output stream. Instead of streaming it directly to the response.out, I create a ChartResult, and let webwork do the chaining for me.
I generate the chart in one class, and I render it out in another class, effectively decoupling the view from the actionsActions. You can easily render it out to a file or some view other than a web response.out
if you wish.
Configuration
xwork.xml - result-types definitions
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<result-types> <result-type name="chart" class="myapp.webwork.extensions.ChartResult"/> </result-types> |
xwork.xml - action definitions
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<action name="viewModerationChart" class="myapp.webwork.actions.ViewModerationChartAction"> <result name="success" type="chart"> <param name="width">400</param> <param name="height">300</param> </result> </action> |
...
Code Block |
---|
<param name="width">400</param> <param name="height">300</param> |
Suggestions for the
...
Next developer...
Currently the "chart" property is hardcoded. There should be a better way of transferring data from the Action to the Result, via some externally defined variable or something.
...