-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi folks,
I'm fairly new to all this and I'm having trouble getting validation to
work as I thought it should. From what I've read in several books now I
should be able to do server side validation, but in my very simple test
case it doesn't seem to be doing anything.
Here is a form bean definition I'm going to use as an example in this
discussion:
<form-bean name="sendEmailForm"
type="org.bcdc.struts.form.SendEmailForm" />
and the associated action definition:
<action
attribute="sendEmailForm"
input=".public.email.send"
name="sendEmailForm"
path="/actions/public/system/sendEmail"
scope="request"
validate="yes"
type="org.bcdc.struts.action.SendEmailAction">
<forward name="class_detail" path="/actions/public/class/detail.do" />
<forward name="failure" path="/actions/public/sendEmail.do" />
The validation configuration:
<form name="sendEmailForm">
<field property="from_rq" depends="require,email">
<arg0 key="sendEmailForm.from_rq.diaplay_name"/>
</field>
<field property="subject_rq" depends="require">
<arg0 key="sendEmailForm.subject_rq.display_name"/>
</field>
<field property="body_rq" depends="require">
<arg0 key="sendEmailForm.body_rq.display_name"/>
</field>
</form>
and here's where the Action is invoking the validation:
ActionErrors ae = sendEmailForm.validate(mapping, request);
if ( ae != null ){
System.err.println("\t\tErrors detected, returning to
the form");
this.addErrors(request, ae);
return mapping.findForward("failure");
}
and here is the validate() method within the form bean:
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
k.
ActionErrors ae = super.validate(mapping, request);
return ae;
}
Now, I invoke the sendEmail form from a browser and I'm watching the
Tomcat logs as this is running and according to the trace validate is
returning a null.
What am I missing here?
This is my first attempt at using validation and none of the text I'm
reading on this topic are very clear...
- --
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Peter L. Berghold [EMAIL PROTECTED]
"Those who fail to learn from history are condemned to repeat it."
AIM: redcowdawg Yahoo IM: blue_cowdawg ICQ: 11455958
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Red Hat - http://enigmail.mozdev.org
iD8DBQFFlUYUUM9/01RIhaARAkzsAJ0YYuoERS43SM5PzK6AMNG4tZY6OgCdHuie
R//HspP2hcdLXBdSngbO8nQ=
=UM21
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]