Hi Niall,

I don't seem to be able to get log output form the validator. Maybe I'm doing something wrong?

This is my commons-logging.properties file:

org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog
org.apache.commons.logging.simplelog.defaultlog=debug
org.apache.commons.logging.simplelog.showlogname=true
org.apache.commons.logging.simplelog.showdatetime=true

And this is my simplelog.properties file:

org.apache.commons.logging.simplelog.log.org.apache.struts.validator=trace

This is not producing any output from the validator at all so I set the default log level to debug and then I see this when I submit the form that is not being validated with no data at all entered (note that every field depends on required):

[DEBUG] ModuleUtils - Get module name for path /do
[DEBUG] ModuleUtils - Module name found: default
[DEBUG] RequestProcessor - Processing a 'POST' for path '/mentor/createStudentGroupStep1' [DEBUG] RequestUtils - Looking for ActionForm bean instance in scope 'session' under attribute key 'createStudentGroupForm' [DEBUG] RequestUtils - Can recycle existing DynaActionForm instance of type 'createStudentGroupForm'?: true [DEBUG] RequestProcessor - Storing ActionForm bean instance in scope 'session' under attribute key 'createStudentGroupForm'
[DEBUG] RequestProcessor -  Populating bean properties from this request
[DEBUG] BeanUtils - BeanUtils.populate(DynaActionForm[dynaClass=createStudentGroupForm,wikiText=,noStudents=,groupName=,groupType=MINORS,studentNames={}], {wikiText=[Ljava.lang.String;@c8d24, page=[Ljava.lang.String;@666b9, noStudents=[Ljava.lang.String;@4200d3, groupName=[Ljava.lang.String;@443251, groupType=[Ljava.lang.String;@438e8c})
[DEBUG] ConvertUtils - Convert string '' to class 'java.lang.String'
[DEBUG] ConvertUtils - Convert string '' to class 'java.lang.String'
[DEBUG] ConvertUtils - Convert string '' to class 'java.lang.String'
[DEBUG] ConvertUtils - Convert string 'MINORS' to class 'java.lang.String'
[DEBUG] RequestProcessor -  Validating input form properties
[DEBUG] RequestProcessor - Looking for Action instance for class vtie.portal.mentor.CreateStudentGroupPrepareAction
[DEBUG] PropertyMessageResources - getMessage(en_US,unhandledException)
[WARN] RequestProcessor - Unhandled Exception thrown: class java.lang.NumberFormatException

To my un-trained eye this looks like the validator is being called but not doing what it should, i.e. throwing a wobbler when it gets no data in any field. The validation for the form in validation.xml is as follows:

<form name="createStudentGroupForm">
  <field property="groupName" page="1" depends="required, mask">
<var><var-name>mask</var-name><var-value>^[a-zA-Z]+[\w\ ]*$</var-value></var>
   <arg0 key="mentor.createStudentGroup.groupName.label"/>
  </field>
  <field property="noStudents" page="1" depends="required, integer">
   <arg0 key="mentor.createStudentGroup.noStudents.label"/>
  </field>
  <field property="studentNames" page="2" depends="required">
   <arg0 key="mentor.createStudentGroup.studentNames.label"/>
  </field>
 </form>

Does any of this make sense to you and can you see anything odd in the traces above?

Thanks,

Bart.

Niall Pemberton wrote:
Try turning on logging in debug mode, should give you more info about
what its doing.

Niall

On 8/3/06, Bart Busschots <[EMAIL PROTECTED]> wrote:
I'm either missing something stupid (which is always possible) or I've
managed to break the validator. I have an app that uses validator all
over the place and it's working fine in all my other actions but for
this one action it is simply not getting called.

I can't see any difference between this action/form/validation and all
the other ones that are working.

This is the form:

  <form-bean name="createStudentGroupForm"
type="org.apache.struts.validator.DynaValidatorForm">
   <form-property name="groupName" type="java.lang.String" />
   <form-property name="noStudents" type="java.lang.String" />
   <form-property name="groupType" type="java.lang.String" />
   <form-property name="wikiText" type="java.lang.String" />
   <form-property name="studentNames" type="java.lang.String[]" />
  </form-bean>

This is the action:

  <action path="/mentor/createStudentGroupStep1"
type="vtie.portal.mentor.CreateStudentGroupPrepareAction"
name="createStudentGroupForm" scope="session" validate="true"
input="/home/mentor/addStudentGroupForm.jsp">
   <forward name="createAnonymous"
path="/do/mentor/createAnonymousStudentGroup" />
   <forward name="getStudentNames"
path="/home/mentor/getStudentNamesForm.jsp" />
   <forward name="fail" path="/home/mentor/addStudentGroupForm.jsp" />
  </action>

And this is the validation:

  <form name="createStudentGroupForm">
   <field property="groupName" page="1" depends="required, mask">
    <var><var-name>mask</var-name><var-value>^[a-zA-Z]+[\w\
]*$</var-value></var>
    <arg0 key="mentor.createStudentGroup.groupName.label"/>
   </field>
   <field property="noStudents" page="1" depends="required, integer">
    <arg0 key="mentor.createStudentGroup.noStudents.label"/>
   </field>
   <field property="studentNames" page="2" depends="required">
    <arg0 key="mentor.createStudentGroup.studentNames.label"/>
   </field>
  </form>

Can anyone see something obviously wrong there?

Cheers,

Bart.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to