Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

why no errors shown for password validation in struts 1.2.4

 
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
john mattucci
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which ones work?
 
What are you doing in my house? Get 'em tiny ad!
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!