struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Newton <davelnew...@gmail.com>
Subject Re: Have you ever used InputConfig annotation?
Date Mon, 08 Nov 2010 16:47:16 GMT
On Mon, Nov 8, 2010 at 10:07 AM, Alfredo Manuel Osorio Martinez wrote:
> Are you saying that input methods shouldn't have any logic in and just
> return the string of the result. If that's the case where should you
> retrieve those list values? What other alternatives do I have? The only
> other one that comes to my mind is Preparable and action tag.

Preparable; I have issues with using <s:action> tag for that as well;
it puts too much responsibility into the view layer, and means you
*must* integration-test the entire flow, including page rendering, in
order to know if the action works, rather than testing the action in
isolation.

My acid test for determining what's appropriate in a method:

Pass:

Q: What does getInputResultNameDo?
A: Returns the name of the input result.

Fail:

Q: What does getInputResultNameDo?
A: It gets the name to use for the input result. And goes to the
database, retrieves a bunch of values, handles persistence-layer
Texceptions, and may populate error messages to return to the user.

> So in the cases where the validation is going to be
> successful why would you want to retrieve the input lists values or
> other stuff for the input result if you are not even going to use it.
> Isn't that unnecessary overhead?

Don't submit to the same action. Or use prepare{methodName}. Or take
advantage of it being a MethodFilterInterceptor and configure it to
run only for the methods you want. Or extend it to default to your
desired application-specific behavior. Or...

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message