Hi All,
I am sure this question has been answered before. I am juggling with few decisions relating validation in web applications.
If I am to implement validation at the Form level, do I use struts validator or write my own validation that extends ActionForm class and have the xxxForm extend it as well:
(class ValidationClass extends ActionForm{}
class xxxForm extends ValidationClass{}
)
I think configuring an XML struts-validator will take longer than writing my own validator to do the same thing.
the other decision is to move validation all together from the web tier to the business tier.
Can some one please enlighten us?
A
Discussions
Web tier: servlets, JSP, Web frameworks: Same Old Question: Struts validator package vs POJO validation
-
Same Old Question: Struts validator package vs POJO validation (3 messages)
- Posted by: ahmed tantan
- Posted on: December 30 2003 10:45 EST
Threaded Messages (3)
- Same Old Question: Struts validator package vs POJO validation by Hari Lakshmanan on December 30 2003 13:27 EST
- Same Old Question: Struts validator package vs POJO validation by ahmed tantan on December 30 2003 17:00 EST
- Don't agree by RebornSpirit ... on January 20 2004 08:15 EST
-
Same Old Question: Struts validator package vs POJO validation[ Go to top ]
- Posted by: Hari Lakshmanan
- Posted on: December 30 2003 13:27 EST
- in response to ahmed tantan
Hi All,
>
> I am sure this question has been answered before. I am juggling with few decisions relating validation in web applications.
> If I am to implement validation at the Form level, do I use struts validator or write my own validation that extends ActionForm class and have the xxxForm extend it as well:
> (class ValidationClass extends ActionForm{}
> class xxxForm extends ValidationClass{}
> )
>
> I think configuring an XML struts-validator will take longer than writing my own validator to do the same thing.
> the other decision is to move validation all together from the web tier to the business tier.
>
> Can some one please enlighten us?
>
> A
Hi
Basically there are two questions
1. Whether to do the validation on web tier or business tier?
2. If you use web tier,Whether to use Struts validator or use POJO validation using actionform's validate method?
The answer to the first question is use validation at both tiers. This basically boils down to client side validation and server side validation. One of the recommendation is to validate early and validate everything. Based on this I would recommend using validation at both tiers.
To answer second question (dependent on answer to first question assuming you want to use client side validation)
I agree struts validator will take more time. However struts validator is more powerful as it supports javascript and also you could reuse the validation rules and all the validation rules are at a central place. As long as the struts validator can support all the validation requirement (client side) of your application , I would go with struts validator.
Hope this helps -
Same Old Question: Struts validator package vs POJO validation[ Go to top ]
- Posted by: ahmed tantan
- Posted on: December 30 2003 17:00 EST
- in response to Hari Lakshmanan
I couldn't agree with you more.
Thank you very much for the clarification. -
Don't agree[ Go to top ]
- Posted by: RebornSpirit ...
- Posted on: January 20 2004 08:15 EST
- in response to Hari Lakshmanan
Well I'm a firm believer of kicking JavaScript to a place where the sun doesn't shine. I prefer doing all my check using just POJO's and nowadays more and more regular expressions. But I'm still looking for a framework where I can see which field have been modified in the web form. I.e. We submit a form, do a lot of checks, there is an invalid field, user adjusts that field but leaves all the rest as it was. Then normally we should recheck every field.
Anyone knows a good technique for solving this kind of problem?