I think it should be best to keep as much business logic out of your 
actions. This helps you to decouple you application logic from it's 
presentation layer.
So, if you have to do some business specific calculations it would be best 
to perform them in some business logic class, like a Enterprise Java Bean.

Cheers,

Harm.




Jeff Kyser <[EMAIL PROTECTED]> 
09/10/2003 01:35 PM
Please respond to
"Struts Users Mailing List" <[EMAIL PROTECTED]>


To
"Struts Users Mailing List" <[EMAIL PROTECTED]>
cc

Subject
Re: What's the best way to do calculations ?






Depends on your calculations.

I wouldn't do anything more than confirm proper data types
with validation - required fields are provided and of the
right type, etc.

If it is a trivial calculation that isn't used anywhere else,
then  you could do it in your Action's execute(),

but if it is a reusable calculation like loan payment
amount given a principal and number of months, etc.,
it sounds more like reusable business logic that should
be in a model object called by your Action's execute.

-jeff

On Wednesday, September 10, 2003, at 04:32  AM, Rouven Gehm wrote:

> Hi,
>
> well i just wonder, in which class i should do my calculations.
> E.g. :
>  I have a JSP, where i have a form for input values, and output values.
> Now i can do the math within the validate Method of the according
> ActionForm, or i do it in the execute Method of the Action where i have
> access to the form too.
> Or is there a third way, to do it ?
>
> Esp. whats the best way, if i have to get values from various 
> ActionForms
> for my calculations ?
>
> Thanx
>
> Rouven
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to