struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wendy Smoak <Wendy.Sm...@asu.edu>
Subject Validator won't validate single required field
Date Fri, 24 Jan 2003 17:20:22 GMT

I know I'm missing something, because the struts-validator example provided
with 1.1b3 works fine.  I've compared all of my own code with the example,
and I don't see what's wrong.

In my own webapp, I set a single field as required and submit the form with
nothing in the field, it doesn't re-display the form with errors, it just
goes off to my 'unrecoverable error' because the Action logic expects that
value to be present.

Here's what I have, hopefully someone will see the problem:

struts-config.xml:

<form-bean      name="chooseProfileForm"
                  type="edu.asu.vpia.struts.ChooseProfileForm"/>        

<action    path="/chooseProfile"
               type="edu.asu.vpia.struts.ChooseProfileAction"
               name="chooseProfileForm"
               scope="request" 
               validate="true"
               input="choose.profile">
       <forward name="success"         path="/viewProfile.do" />
       <forward name="resolution"      path="/resolveName.do" />
    </action>

<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
    <set-property property="pathnames" value="/WEB-INF/validator-rules.xml,
                                              /WEB-INF/validation.xml"/>
</plug-in>

When the webapp starts, I see this in the logs:

09:59:02,356 - INFO org.apache.struts.validator.ValidatorPlugIn - Loading
validation rules file from '/WEB-INF/validator-rules.xml'
09:59:04,813 - INFO org.apache.commons.validator.ValidatorResources - Add
ValidatorAction: email,org.apache.struts.validator.FieldChecks
09:59:04,813 - INFO org.apache.struts.validator.ValidatorPlugIn - Loading
validation rules file from '/WEB-INF/validation.xml'
{snipped a bunch of the above lines}
09:59:05,084 - INFO org.apache.commons.validator.ValidatorResources - Adding
FormSet 'FormSet: language=null  country=null  variant=null
   Form: chooseProfileForm
	Field: 
		key=                 nameOrId
		property=            nameOrId
		indexedProperty=     null
		indexedListProperty= null
		depends=             required
		page=                0
		fieldOrder=          0
		Vars:

But when I visit the form and submit it with nothing in that field:

10:08:17,963 - DEBUG org.apache.struts.action.RequestProcessor -  Validating
input form properties
10:08:17,963 - DEBUG org.apache.struts.action.RequestProcessor -   No errors
detected, accepting input

Does anyone see what's wrong?

-- 
Wendy Smoak
Applications Systems Analyst, Sr.
Arizona State University PA Information Resources Management

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message