• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Automatic Validation does not work

 
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 17652
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Garandi Garandi
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
reply
    Bookmark Topic Watch Topic
  • New Topic