--------------Boundary-00=_JJRSLVC0000000000000 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable HI again=0D this pdf gives u good start to the validator framework=0D http://www.manning.com/husted/chap12.pdf=0D =0D also u can deploy the struts-validator.war that comes with the struts release and go thro' the jsps, validator.xml, validator-rules.xml=0D =0D --nagi=0D =0D -------Original Message-------=0D =0D From: Struts Users Mailing List=0D Date: Thursday, July 10, 2003 12:10:40 PM=0D To: 'Struts Users Mailing List'=0D Subject: RE: What should be in validate() method when using struts valida= tor package=0D =0D Can you please explain how to use validator for client side validations? = Any sample code on the web (links would be helpful).=0D =0D =0D Thanks=0D Sriram=0D =0D -----Original Message-----=0D From: Nagendra Kumar O V S [mailto:nagendra@ikigo.com] =0D Sent: Thursday, July 10, 2003 11:59 AM=0D To: struts-user@jakarta.apache.org=0D Subject: Re: What should be in validate() method when using struts valida= tor package=0D =0D =0D =0D hi,=0D struts validator provides both client side as well as server side validations.=0D if u want to use the serverside validations , u have to extend the validatorForm instead of ActionForm and remove the validate() method all together.=0D but, in my application, i am using validator for client side validations = and on the server side i still use plain vanilla Action forms and validation method (for validations) for my own business requirements.=0D so its a matter of choice.=0D =0D --nagi=0D =0D -------Original Message-------=0D =0D From: Struts Users Mailing List=0D Date: Thursday, July 10, 2003 11:42:11 AM=0D To: 'Struts Users Mailing List'=0D Subject: What should be in validate() method when using struts validator package=0D =0D What should be in validate() method when we use Struts Validator package?= =0D Should it be an empty method?=0D =0D My current validate() method (without using Struts Validator) is as follows:(What should it be if I implement validations in validator-rules.= xml and validations.xml)? Pl. suggest.=0D =0D public ActionErrors validate(ActionMapping mapping,=0D javax.servlet.http.HttpServletRequest request) {=0D // maintenance forms do new, update and delete, but also searches and cre= ate new for=0D // fkey resolvers. Only new and update actually need validation.=0D if (!lrAction_.equals("New") && !lrAction_.equals("Update")) return null;= =0D =0D ActionErrors errs =3D new ActionErrors();=0D SupportValues support =3D new SupportValues();=0D =0D =0D =0D try {=0D support.setContactName(contactName_);=0D } catch (IllegalArgumentException ex) {=0D errs.add(FLD_CONTACT_NAME,new ActionError("supportviewform error_contact_name",ex.getMessage()));=0D }=0D try {=0D support.setContactDetail(contactDetail_);=0D } catch (IllegalArgumentException ex) {=0D errs.add(FLD_CONTACT_DETAIL,new ActionError("supportviewform error_contact_detail",ex.getMessage()));=0D }=0D try {=0D support.setPhoneNo(phoneNo_);=0D } catch (IllegalArgumentException ex) {=0D errs.add(FLD_PHONE_NO,new ActionError("supportviewform.error_phone_no",ex getMessage()));=0D }=0D try {=0D support.setEmailAddr(emailAddr_);=0D } catch (IllegalArgumentException ex) {=0D errs.add(FLD_EMAIL_ADDR,new ActionError("supportviewform.error_email_addr= " ex.getMessage()));=0D }=0D try {=0D support.setSubject(subject_);=0D } catch (IllegalArgumentException ex) {=0D errs.add(FLD_SUBJECT,new ActionError("supportviewform.error_subject",ex getMessage()));=0D }=0D try {=0D support.setMessage(message_);=0D } catch (IllegalArgumentException ex) {=0D errs.add(FLD_MESSAGE,new ActionError("supportviewform.error_message",ex getMessage()));=0D } =0D if (errs.empty()) return null;=0D =0D // preserve selected values in the form, so on error don't lose them all.= =0D preserveSelectedValues(request);=0D =0D return errs;=0D } // end of validate=0D =0D =0D =0D =0D ____________________________________________________=0D IncrediMail -= Email has finally evolved - Click Here=20 --------------Boundary-00=_JJRSLVC0000000000000 Content-Type: Text/HTML; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
HI again
this pdf gives u good start to the validator framework
http://www.mannin= g.com/husted/chap12.pdf
 
also u can deploy the struts-validator.war that comes with the= struts=20 release and go thro' the jsps, validator.xml, validator-rules.xml
 
--nagi
 
-------Original Message-------<= /I>
 
From: Struts Users Mailing= =20 List
Date: Thursd= ay, July=20 10, 2003 12:10:40 PM
To: 'Struts Users Mailin= g=20 List'
Subject: RE:= What=20 should be in validate() method when using struts validator=20 package
 
Can you please explain how to use validator for cl= ient=20 side validations? Any sample code on the web (links would be=20 helpful).


Thanks
Sriram

-----Original=20 Message-----
From: Nagendra Kumar O V S [mailto:nagendra@ikigo.com] <= BR>Sent:=20 Thursday, July 10, 2003 11:59 AM
To: struts-user@jakarta.= apache.org
Subject:=20 Re: What should be in validate() method when using struts validator= =20 package



hi,
struts validator provides both client= side=20 as well as server side validations.
if u want to use the servers= ide=20 validations , u have to extend the validatorForm instead of ActionF= orm and=20 remove the validate() method all together.
but, in my applicatio= n, i am=20 using validator for client side validations and on the server side = i still=20 use plain vanilla Action forms and validation method (for validatio= ns) for=20 my own business requirements.
so its a matter of=20 choice.

--nagi

-------Original Message-------

= From:=20 Struts Users Mailing <mailto:struts-user@j= akarta.apache.org>=20 List
Date: Thursday, July 10, 2003 11:42:11 AM
To: 'Struts Us= ers=20 Mailing <mailto:struts-user@j= akarta.apache.org>=20 List'
Subject: What should be in validate() method when using st= ruts=20 validator package

What should be in validate() method when w= e use=20 Struts Validator package?
Should it be an empty method?

M= y=20 current validate() method (without using Struts Validator) is as=20 follows:(What should it be if I implement validations in=20 validator-rules.xml and validations.xml)? Pl. suggest.

publi= c=20 ActionErrors validate(ActionMapping=20 mapping,
javax.servlet.http.HttpServletRequest request) {
//=20 maintenance forms do new, update and delete, but also searches and = create=20 new for
// fkey resolvers. Only new and update actually need=20 validation.
if (!lrAction_.equals("New") &&=20 !lrAction_.equals("Update")) return null;

ActionErrors errs = =3D new=20 ActionErrors();
SupportValues support =3D new=20 SupportValues();



try=20 {
support.setContactName(contactName_);
} catch=20 (IllegalArgumentException ex) {
errs.add(FLD_CONTACT_NAME,new=20 ActionError("supportviewform.error_contact_name",ex.getMessage()));=
}
try=20 {
support.setContactDetail(contactDetail_);
} catch=20 (IllegalArgumentException ex) {
errs.add(FLD_CONTACT_DETAIL,new=20 ActionError("supportviewform.error_contact_detail",ex.getMessage())= );
}
try=20 {
support.setPhoneNo(phoneNo_);
} catch (IllegalArgumentExcep= tion=20 ex) {
errs.add(FLD_PHONE_NO,new=20 ActionError("supportviewform.error_phone_no",ex.getMessage()));
= }
try=20 {
support.setEmailAddr(emailAddr_);
} catch=20 (IllegalArgumentException ex) {
errs.add(FLD_EMAIL_ADDR,new=20 ActionError("supportviewform.error_email_addr",ex.getMessage()));}
try=20 {
support.setSubject(subject_);
} catch (IllegalArgumentExcep= tion=20 ex) {
errs.add(FLD_SUBJECT,new=20 ActionError("supportviewform.error_subject",ex.getMessage()));
}=
try=20 {
support.setMessage(message_);
} catch (IllegalArgumentExcep= tion=20 ex) {
errs.add(FLD_MESSAGE,new=20 ActionError("supportviewform.error_message",ex.getMessage()));
}=
if=20 (errs.empty()) return null;

// preserve selected values in t= he=20 form, so on error don't lose them=20 all.
preserveSelectedValues(request);

return errs;
} /= / end=20 of=20 validate




_______________________________________= _____________
<http://www.incredimail.com/redir.asp?ad_id=3D309&lang=3D9>=20 IncrediMail - Email has finally evolved - <http://www.incredimail.com/redir.asp?ad_id=3D309&lang=3D9>=20 Click Here


=09 =09 =09 =09 =09 =09 =09
____________________________________________________
  IncrediMai= l -=20 Email has finally evolved -
Click=20 Here
--------------Boundary-00=_JJRSLVC0000000000000--