To add onto that....

Using resuest.getA  in the action does not make any sense since struts
already does that for you by populating the form from the request param
after the reset method on the form is called. 

Form should be the only data repository  for you to consider between
your view and model.

 



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: Monday, January 12, 2004 11:53 AM
To: [EMAIL PROTECTED]
Subject: RE: Mandatory use of form rather than request object

Hi,
Its a good idea to use just form.getAttribute than use
request.getparameter..I think that is major advantage with struts...You
should no longer be using this syntax.The form should be a complete
container as far as actions are concerned.The advantage is that just by
looking at the form you should know what all data is required if the
form is properly documents.That is one of the reasons I do not like
using request.getParameter as it sort of smells of the magic key
approach,there .

But I don't think you can remove parameters from the request as there is
no such method there..Nor you can add parameters to a request.
the only thing I can think of is to do a code review and include it in
the coding guidelines.


HTH.
regards,
Shirish

-----Original Message-----
From: Abhishek Srivastava [mailto:[EMAIL PROTECTED]
Sent: Monday, January 12, 2004 4:19 PM
To: 'Struts Users Mailing List'
Subject: Mandatory use of form rather than request object


Hello All,

I did some code reviews recently for my project being done on struts.

I found that most people still do a request.getAttribute("NAME") kind of
code even when the name is a property of the form object and is
available in the form object.

My question is should the use of form be mandatory. If yes, how it can
be enforced. Is there quick way I can remove all the params/attributes
from the request object once the corresponding values have been set in
the form object?

Thanks in advance for your advise.

Regards,
Abhishek.

---------------------------------------------------------------------
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