wood burning stoves 2.0*
The moose likes Struts and the fly likes Struts Password and Email server-side validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Password and Email server-side validation " Watch "Struts Password and Email server-side validation " New topic
Author

Struts Password and Email server-side validation

Nina Anderson
Ranch Hand

Joined: Jul 18, 2006
Posts: 148
Hi guys,

I'm trying to switch from client-side to Server-side validation. However, I don't know how I can validate "password" and "email" fields on the server-side.

Please help me on how I can change the following to Server-side:

Gary Dhaliwal
Greenhorn

Joined: Oct 17, 2008
Posts: 11
You can leave your validation.xml as is (Make sure you have a <form name=?> tag around your fields).

Now instead of subclassing your form beans from ActionForm subclass from ValidatorForm

ie. Change public class CompanySearchForm extends ActionForm{
to public class CompanySearchForm extends ValidatorForm{

And lastly make sure your action tag in struts-config.xml has validate="true"

i.e. <action path="/createJob" validate="true" ...
[ October 19, 2008: Message edited by: G Dddd ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60752
    
  65

"G Dddd", please check your private messages for an important administrative matter.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Gary Dhaliwal
Greenhorn

Joined: Oct 17, 2008
Posts: 11
ok.
Nina Anderson
Ranch Hand

Joined: Jul 18, 2006
Posts: 148
Thanks for your response. This was helpful.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Struts Password and Email server-side validation
 
Similar Threads
Struts validator Framework
Using masks in Validations
custom validator and custom tags
How to check if field exist in validation.xml
Custom validation by validator-rules.xml is not working