RE: Struts Validations ??

2002-11-29 Thread Deepika Malik
hi,
I am myself doing quite a bit of research on this.
but have not been able to come to an effective solution.

According to me the simpler validations should be in javascript.
as this would save
1)one trip to the server.
2)would not make the page too heavy with javascript.
3)too complex validations in javascript are always a pain.
but these validation should again be repeated on the server 'cos
javascript validation can easily be disabled on the browser.

What you need to do in validate method of actionform
for server side validation is:
public ActionErrors validate(ActionMapping mapping,
 HttpServletRequest request)
 {

ActionErrors errors = new ActionErrors();
 if (formAttribute == null)
  errors.add(formAttribute , new
ActionError(error.username.required));


return errors;

}
lets say you are validating that your formAttribute cannot be null.
then you will add this error to errors object with the same name as your
attribute.
In this case,formAttribute.
error.username.required -have this entry in your properties file.
and in your jsp page
html:errors property=formAttribute/
this will display your error.

Thanks,
Deepika

-Original Message-
From: Rajendra Yadav [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 29, 2002 3:17 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Struts Validations ??



Hi All,

I need some information regarding the usgae of the struts validations.

If anyone is using it, please let me know the pros and cons of it and how
effective it is if compared to javascript validations.

Thanks,

- Raj



-
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now


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




Re: Struts Validations ??

2002-11-29 Thread Ted Husted
This is really a question for the Struts USER list. 

There are a couple of extensions available for Struts 1.0 that 
provide both client-side and server-side validations. One of 
these, the Commons/Strtus Validator, is being bundled with Struts 
1.1.

Questions regarding how to use any of these should be directed to 
the USER list. 

-Ted.


11/29/2002 6:17:26 AM, Rajendra Yadav [EMAIL PROTECTED] wrote:

Hi All,

I need some information regarding the usgae of the struts 
validations.

If anyone is using it, please let me know the pros and cons of it 
and how effective it is if compared to javascript validations.

Thanks,

- Raj



-
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now





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