You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jonatas Gustavo Rodrigues <jo...@pgr.mpf.gov.br> on 2007/03/15 03:48:43 UTC
How to change the return of an action ?
The DefaultActionInvocation returns only a String or a Result from an
action invocation.
Why struts does not permit the action to return something else, like an
Object ?
In this way, this object (like an UIComponent) could be used for an
registered Result object to render the result (this Tapestry).
I think the source could be more generic, flexible and extensible.
Thanks
Godoi
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: How to change the return of an action ?
Posted by Laurie Harper <la...@holoweb.net>.
Dave Newton wrote:
> --- Jonatas Gustavo Rodrigues wrote:
>> In this way, this object (like an UIComponent) could
>> be used for an> registered Result object to render
>> the result (this Tapestry).
>
> I expect that you could create a result type mapping
> from a String result to whatever you wanted, the same
> way there are about a dozen different result types.
>
> Returning a string makes testing and configuration
> insanely easy... From
> http://cwiki.apache.org/WW/result-configuration.html:
> 'An Action can pass back a token like "success" or
> "error" without knowing any other implementation
> details.'
>
> This means that all your Action does is send back a
> token. The command pattern *configuration* decides
> what to do with that token, possibly rendering a JSP,
> redirecting to a different S2 action, etc.
>
> See also:
> http://cwiki.apache.org/WW/result-types.html
Also note that if you really wanted to pass something like a UIComponent
instance to a result you could do so through the request scope or OGNL
value stack. And you can always render the response through whatever
means you want and return null, in the extreme case.
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: How to change the return of an action ?
Posted by Dave Newton <ne...@yahoo.com>.
--- Jonatas Gustavo Rodrigues wrote:
> In this way, this object (like an UIComponent) could
> be used for an> registered Result object to render
> the result (this Tapestry).
I expect that you could create a result type mapping
from a String result to whatever you wanted, the same
way there are about a dozen different result types.
Returning a string makes testing and configuration
insanely easy... From
http://cwiki.apache.org/WW/result-configuration.html:
'An Action can pass back a token like "success" or
"error" without knowing any other implementation
details.'
This means that all your Action does is send back a
token. The command pattern *configuration* decides
what to do with that token, possibly rendering a JSP,
redirecting to a different S2 action, etc.
See also:
http://cwiki.apache.org/WW/result-types.html
d.
____________________________________________________________________________________
Looking for earth-friendly autos?
Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.
http://autos.yahoo.com/green_center/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org