I've read the article now too, and must say i can't disagree more.

First:

>HTML FORM is submitted from the input page, usually using POST request
method. Struts populates form bean (marked with [F]) with 
>request data. Then form bean validates input and if something wrong, it
generates error messages. If validate() returns errors, Struts 
>does not bother to call action class. Instead, it forwards to location,
which is defined in "input" property of <action> element. If, 
>on the other hand, input data is correct, Struts calls execute() method of
the action class. It usually performs model update, then 
>fills out form bean with output values, and forwards to JSP page, which
displays output data. 

Especially the last one: 
>fills out form bean with output values, and forwards to JSP page, which
displays output data

Is complete nonsense in my eyes. I've never seen an application doing this.
Maybe I haven't seen enough struts applications, 
but our current application for example, with 1500 classes, 500 jsps, and
over 100K lines of code doesn't show this behaviour at a single place. 

ActionForms are "the better way" to parse request after form submission.
That's it. Nothing less, nothing more. 

...

Further in text:

> Form bean is used both for input and for output. If input and output page
uses same fields, this is OK, but usually this is not the 
> case. So, one form has to combine input and output fields. 

See above. I don't think it's struts typical, if it is, again, never seen
this before.

> On error action class is not called. This may be useful in some cases, but
not always

This depends solely on the validation technique. Actually we are using
validate methods of the ActionForm solely to perform javascript validation
on the client side (to reduce traffic for client) and to backup it on the
server side in case one switched off javascript. 
What I do validate in Forms are things like length of a specific text field
or presence of needed fields.
If logic is required, the validation is performed in the action, or even in
the service layer.

>On error control is forwarded to location, defined in "input" property.
This property itself is a source of misunderstanding for 
>Struts newbies, and makes clean request->processing->response sequence a
little fuzzy. 

Typicall for all GUI applications, isn't it? If you don't like it, you can
override this behavior. Noone says you MUST use actionforms, struts has
enough power without action forms.

>Because in case of error most applications forward to input page instead of
redirecting, page is sent back to broswser immediately in >response to POST
request. This produces POSTDATA effect on reload, which results in double
sumbit. 

Aehm... The double submit problem is not a problem of POST or GET request.
Ist a problem of bad programmed browsers, proxies etc, and there are enough
techniques to avoid it.


Since your preposition about "Traditional Struts request/response cycle"
isn't TRUE in my eyes, you provide a solution to a problem, that doesn't
exists :-) 

Now seriously. Using ActionForms for result presentation is just a matter of
bad style, it doesn't mean, that struts is badstyles, 
after all, everything, that can be misused, will be :-)


Regards
Leon











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

Reply via email to