This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Automatic Validation does not work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Automatic Validation does not work" Watch "Automatic Validation does not work" New topic
Author

Automatic Validation does not work

Garandi Garandi
Ranch Hand

Joined: Jan 07, 2003
Posts: 192
I am trying to validate a form, but it does not work.
I am trying to do Automatic Validation.
These are the steps that I took.
1: struts-config.xml
<message-resources parameter="ApplicationResources"/>
2: turned on the validation
<plug-in
className="org.apache.struts.validator.ValidatorPlugIn">
<set-property
property="pathnames"
value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
</plug-in>

3: Validation.xml
put validation rule in validation.xml

<formset>
<form name="contactInfo">
<field property="nameFirst" depends="required">
<arg0 key="prompt.username"/>

</field>
</form>

</formset>

where property="nameFirst" is the name of field in jsp file.
4: public class ContactInfoBean extends ValidatorForm
5:In my jsp page I have
<html:errors/>
AND
<html:form action="/contactInfoEdit" onsubmit="return validateContactInfoBean(this);">

6:struts-config.xml
<form-bean name="contactInfo" type="com.mypage.MyBean"/>
7:<action-mappings>
<action path="/contactInfoEdit"
type="com.mypage.ContactInfoEditAction"
scope="session"
name="contactInfo"
input="/contact_Info_edit.jsp"
validate="true">
<forward name="confirm" path="/jsp/overview.jsp"/>
</action>
</action-mappings>

But the validation does not validate the form.
Thank you
Garandi
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4445
    
    5

4: public class ContactInfoBean extends ValidatorForm
5:In my jsp page I have
<html:errors/>
AND
<html:form action="/contactInfoEdit" onsubmit="return validateContactInfoBean(this);">

6:struts-config.xml
<form-bean name="contactInfo" type="com.mypage.MyBean"/>

Value of "type" should be the fully qualified name of ContactInfoBean.


Junilu - [How to Ask Questions] [How to Answer Questions]
Garandi Garandi
Ranch Hand

Joined: Jan 07, 2003
Posts: 192
Lacar,
Thank you very much for reply. But type is fully qualified.
6:struts-config.xml
<form-bean name="contactInfo" type="com.mypage.ContactInfoBean"/>
But still the validation does not work.

Thank you in advance
Garandi
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Automatic Validation does not work
 
Similar Threads
LookupDispatch action with validator
Form validation in struts
Struts validation not displaying error messages
What Are the Causes for Validation Not Doing Anything?
Struts Validator With Modules