aspose file tools*
The moose likes Struts and the fly likes Problem with validator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem with validator" Watch "Problem with validator" New topic
Author

Problem with validator

Saji T.Sathian
Greenhorn

Joined: Nov 27, 2008
Posts: 7
I have the following entry in struts-config.xml

<action path="/registration"
type="com.search.bb.account.struts.UserRegistrationAction"
name="userRegistrationForm"
input="site.page.registration"
validate="true">

<forward name="success"
path="site.page.registrationSuccess">
</forward>

</action>

Problem is that if validation fails control is not forwarded to the value
of 'input' attribute of the action element.Insted I get a blank page

If validate attribute is set to 'false' everything works fine.

But that does not help validation.

If you have solved problems of this kind please help
Saji T.Sathian
Greenhorn

Joined: Nov 27, 2008
Posts: 7
One thing I forgot to mention is that of Form Bean.

<form-bean name="userRegistrationForm" type="org.apache.struts.validator.DynaValidatorForm">
<display-name>userRegistrationForm</display-name>
<form-property name="userID" type="java.lang.String"></form-property>
<form-property name="password" type="java.lang.String"></form-property>
<form-property name="confirmationPassword" type="java.lang.String"></form-property>
<form-property name="email" type="java.lang.String"></form-property>
<form-property name="bloodGroup" type="java.lang.String"></form-property>
<form-property name="name" type="java.lang.String"></form-property>
<form-property name="gender" type="java.lang.String"></form-property>
<form-property name="dateOfBirth" type="java.lang.String"></form-property>
<form-property name="address" type="java.lang.String"></form-property>
<form-property name="district" type="java.lang.String"></form-property>
<form-property name="state" type="java.lang.String"></form-property>
<form-property name="country" type="java.lang.String"></form-property>
<form-property name="phone" type="java.lang.String"></form-property>
<form-property name="mobileNO" type="java.lang.String"></form-property>

</form-bean>

Please note type of form bean is

org.apache.struts.validator.DynaValidatorForm

Regards,

Saji T Sathian
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I'd guess there's an error in the validation config/code or in the JSP. Is there anything in the log?
Saji T.Sathian
Greenhorn

Joined: Nov 27, 2008
Posts: 7
Thank you very much for reading my post.

The configuration is as follows

<form-validation>
<global>

</global>
<formset>
<form name="userRegistrationForm">
<field property="userID" depends="required,mask">
<msg name="mask" key="userRegistration.userID.maskmsg"></msg>
<arg0 key="userRegistration.userID.displayname"></arg0>
<var>
<var-name>mask</var-name>
<var-value>^[a-zA-Z0-9]*$</var-value></var></field></form></formset>
</form-validation>

The JSP works fine when 'validate' attribute of action element is set to 'false'

Nothing is available with logs.

Regards,
Saji T Sathian
Saji T.Sathian
Greenhorn

Joined: Nov 27, 2008
Posts: 7
I failed to resolve the problem yet.I have found some more problems with client side validation. validateMinlength() is notworking with password
fields. validateDate() is also have problems.You have to edit these two
functions for getting correct output.

Regards,
Saji T Sathian
Saji T.Sathian
Greenhorn

Joined: Nov 27, 2008
Posts: 7
Everything I mentioned was only applicable to struts 1.1
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with validator