emre akbas wrote the following on 9/9/2005 10:12 AM:
 ,
I want to know what the state-of-the-art practices about Struts validation are. It is well-known that there are some problems in automatic validation. Here is a good article: http://www.reumann.net/struts/articles/request_lists.jsp Are the ideas in this article obsolete?

I don't think they are obsolete. I still find it easier to call validate manually. (By the way, in that article, I mention a technique that I really don't use myself.. I don't even bother calling the form's validate method. I actually provide my own validate() method in my Action that validates what I want. Both work ok though and since many already have a validate method in their ActionForm, I used that as the example for the lesson.)

As far as I understand, the best practice is calling the validate() method manually.

If you have session based forms or you do not need to re-display non-ActionForm objects back on the page if validation fails, the standard validation framework is 'ok', but I still like to do do things one consistent way so doing my validation in my actions works for me. I will almost bet there will be a time when you'll run into some headaches trying to use the validation frameworks as it stands. (Validation in struts is not one of Struts' strong points unfortunately. It's one of the number one headaches for beginning struts users.)

This requires that we write ... validate="false" ... in the action-mapping definition.

If I remember correctly, if you leave off the validate="false" it defaults to false. You just need to set it to true if you want validation, but I could be wrong there.. it's been a while:)

However, if we do this, we cannot use javascript (client-size) validation. I want to use javascript validation. What are the possible solutions?

I never had too much luck with the client side validation stuff and I only use it in *very* limited circumstances, since I like validating on the server side. The javascript validation with the validator seemed more of a headache then it was worth when I first started trying it out (I'm sure it's improved a lot since then, so it might work nicely for you). For client side validation I just write my own and don't rely on the validator stuff to handle it. Since I rarely validate on the client it's not much of an issue for me.

--
Rick

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

Reply via email to