Thanks for that. I've gone thru the pdf and am trying to implement client-side
validations.
I've done as explained in that chapter.
I've placed the relevant code in .jsp file and also this line in the end (before
closing BODY tag).
<validator:javascript formName="supportviewForm"/>
But this is causing a problem. The form isnot getting displayed completely. It's
showing the following error:
javax.servlet.ServletException: org/apache/struts/util/MessageResources
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageCon
textImpl.java:536)
When I remove <validator:javascript formName="supportviewForm"/> from .jsp page, the
form is getting displayed properly. What could be the reason?
-----Original Message-----
From: Nagendra Kumar O V S [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 10, 2003 12:32 PM
To: [EMAIL PROTECTED]
Subject: RE: What should be in validate() method when using struts validator package
HI again
this pdf gives u good start to the validator framework
http://www.manning.com/husted/chap12.pdf <http://www.manning.com/husted/chap12.pdf>
also u can deploy the struts-validator.war that comes with the struts release and go
thro' the jsps, validator.xml, validator-rules.xml
--nagi
-------Original Message-------
From: Struts Users Mailing <mailto:[EMAIL PROTECTED]> List
Date: Thursday, July 10, 2003 12:10:40 PM
To: 'Struts Users Mailing <mailto:[EMAIL PROTECTED]> List'
Subject: RE: What should be in validate() method when using struts validator package
Can you please explain how to use validator for client side validations? Any sample
code on the web (links would be helpful).
Thanks
Sriram
-----Original Message-----
From: Nagendra Kumar O V S [mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ]
Sent: Thursday, July 10, 2003 11:59 AM
To: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
Subject: Re: What should be in validate() method when using struts validator package
hi,
struts validator provides both client side as well as server side validations.
if u want to use the serverside validations , u have to extend the validatorForm
instead of ActionForm and remove the validate() method all together.
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.
so its a matter of choice.
--nagi
-------Original Message-------
From: Struts Users Mailing <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > List
Date: Thursday, July 10, 2003 11:42:11 AM
To: 'Struts Users Mailing <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > List'
Subject: What should be in validate() method when using struts validator package
What should be in validate() method when we use Struts Validator package?
Should it be an empty method?
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.
public ActionErrors validate(ActionMapping mapping,
javax.servlet.http.HttpServletRequest request) {
// maintenance forms do new, update and delete, but also searches and create new for
// fkey resolvers. Only new and update actually need validation.
if (!lrAction_.equals("New") && !lrAction_.equals("Update")) return null;
ActionErrors errs = new ActionErrors();
SupportValues support = new SupportValues();
try {
support.setContactName(contactName_);
} catch (IllegalArgumentException ex) {
errs.add(FLD_CONTACT_NAME,new
ActionError("supportviewform.error_contact_name",ex.getMessage()));
}
try {
support.setContactDetail(contactDetail_);
} catch (IllegalArgumentException ex) {
errs.add(FLD_CONTACT_DETAIL,new
ActionError("supportviewform.error_contact_detail",ex.getMessage()));
}
try {
support.setPhoneNo(phoneNo_);
} catch (IllegalArgumentException ex) {
errs.add(FLD_PHONE_NO,new
ActionError("supportviewform.error_phone_no",ex.getMessage()));
}
try {
support.setEmailAddr(emailAddr_);
} catch (IllegalArgumentException ex) {
errs.add(FLD_EMAIL_ADDR,new
ActionError("supportviewform.error_email_addr",ex.getMessage()));
}
try {
support.setSubject(subject_);
} catch (IllegalArgumentException ex) {
errs.add(FLD_SUBJECT,new ActionError("supportviewform.error_subject",ex.getMessage()));
}
try {
support.setMessage(message_);
} catch (IllegalArgumentException ex) {
errs.add(FLD_MESSAGE,new ActionError("supportviewform.error_message",ex.getMessage()));
}
if (errs.empty()) return null;
// preserve selected values in the form, so on error don't lose them all.
preserveSelectedValues(request);
return errs;
} // end of validate
____________________________________________________
<http://www.incredimail.com/redir.asp?ad_id=309
<http://www.incredimail.com/redir.asp?ad_id=309&lang=9> &lang=9> IncrediMail - Email
has finally evolved - <http://www.incredimail.com/redir.asp?ad_id=309
<http://www.incredimail.com/redir.asp?ad_id=309&lang=9> &lang=9> Click Here
____________________________________________________
<http://www.incredimail.com/redir.asp?ad_id=309&lang=9> IncrediMail - Email has
finally evolved - <http://www.incredimail.com/redir.asp?ad_id=309&lang=9> Click Here