aspose file tools*
The moose likes Struts and the fly likes why no errors shown for password validation in struts 1.2.4 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "why no errors shown for password validation in struts 1.2.4" Watch "why no errors shown for password validation in struts 1.2.4" New topic
Author

why no errors shown for password validation in struts 1.2.4

john mattucci
Ranch Hand

Joined: Nov 03, 2000
Posts: 331
I have the following in my validation.xml file

<field property="passwordconfirm"
depends="required">
<arg0 key="registration.passwordconfirm"/>
</field>

In my jsp I have the following

Password Confirm<html assword property="passwordconfirm" size="10" />
<html:errors property="passwordconfirm"/>

In my ApplicationResources.properties file I have the following
errors.required={0} is required.

registration.firstname = First name
registration.passwordconfim= Password

Other text fields work fine i.e. the errors are shown
Klaus Jesper
Greenhorn

Joined: Jan 20, 2005
Posts: 15
Try using this in your jsp:

<html:messages property="passwordconfirm" message="false" id="pwConfirm" >
<bean:write name="pwConfirm"/>
</html:messages>

This article could help:
http://www.oracle.com/technology/oramag/oracle/04-jan/o14dev_struts.html

Klaus
john mattucci
Ranch Hand

Joined: Nov 03, 2000
Posts: 331
that does not work either.

I have over a dozen fields and most of them work. However a few for life of me
I cant get to work i.e. password, cofirm password, country

In my jsp I have

Country <html:text property="country" size="10" />
<html:errors property="country"/>

In my validation.xml I have

<field
property="country
depends="required">
<arg key="registration.country"/>
</field>

In my ApplicationResources.properties

registration.country = Country

In my struts-config I have

<form-beans>
<form-bean name="registrationDynaValidateForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="firstname" type="java.lang.String"/>
<form-property name="lastname" type="java.lang.String"/>
<form-property name="phone" type="java.lang.String"/>
<form-property name="address1" type="java.lang.String"/>
<form-property name="city" type="java.lang.String"/>
<form-property name="province" type="java.lang.String"/>
<form-property name="postalcode" type="java.lang.String"/>
<form-property name="country" type="java.lang.String"/>
.....


Like I said for others I have done the same thing and they work. Has anybody else had this problem?
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

Make sure it is mapped to the form correctly in the validation.xml. Do you have fields in the same form that work or are the ones that work locately elsewhere?


A good workman is known by his tools.
john mattucci
Ranch Hand

Joined: Nov 03, 2000
Posts: 331
There are about 15 fields in the same form and a little over half work and the others for some reason dont. I cant figure this out. This is part of the validation.xml

<form-validation>
<formset>
<form name="registrationDynaValidateForm">

<field
property="postalcode"
depends="required">
<arg0 key="registration.postalcode"/>
</field>
<field
property="country"
depends="required">
<arg key="registration.country"/>
</field>
<field
property="deviceid"
depends="required,mask">
<arg0 key="registration.deviceid"/>
<var>
<var-name>mask</var-name>
<var-value>^[0-9a-zA-Z]*$</var-value>
</var>
</field>
<field
property="creditcardtype"
depends="required">
<arg0 key="registration.creditcardtype"/>
</field>
<field
property="ccnumber"
depends="creditCard">
<arg0 key="registration.ccnumber"/>
</field>
<field property="expirymonth" depends="validwhen">
<arg0 key="registration.expirymonth"/>
<var>
<var-name>test</var-name>
<var-value>((ccnumber == null) or (*this* != null))</var-value>
</var>
</field>
<field property="expiryyear" depends="validwhen">
<arg0 key="registration.expiryyear"/>
<var>
<var-name>test</var-name>
<var-value>((ccnumber == null) or (*this* != null))</var-value>
</var>
</field>
<field property="securitynumber" depends="requireif">
<arg0 key="registration.securitynumber"/>
<var>
<var-name>field[0]</var-name>
<var-value>creditcardtype</var-value>
</var>
<var>
<var-name>fieldTest[0]</var-name>
<var-value>EQUAL</var-value>
</var>
<var>
<var-name>fieldValue[0]</var-name>
<var-value>Visa</var-value>
</var>
</field>

<field property="passwordconfirm"
depends="required">
<arg0 key="registration.passwordconfirm"/>
</field>
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

I cant get to work i.e. password, cofirm password, country

password is not in your validation.xml
passwordconfirm might be a case-sensitive issue. Check the "C/c"
country has "arg" and not "arg0"

Hope at least one of these fixes something.
[ January 21, 2005: Message edited by: Marc Peabody ]
john mattucci
Ranch Hand

Joined: Nov 03, 2000
Posts: 331
I didnt post my entire validation.xml that is why you dont see password. The cases are right for all of them I have checked them many times. I changed country arg0, however the error for country does not come through......
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

Which ones work?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why no errors shown for password validation in struts 1.2.4
 
Similar Threads
validator plugin and validate() method needs to use together
Custom Validations in Struts Validator Framework?
Client-side validation not picking up message.
Validation problem with Struts1.2
Validating Two Fields Match