Caroline Jen wrote:

Do not understand the 'HTTP Status 500 -
java.lang.ClassCastException org.apache.struts.validator.DynaValidatorForm.validate(DynaValidatorForm.java:141)'



1. I have this plug-in by the very end of the struts-config.xml file:

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


2. I have this action mapping in the struts-config.xml
file:

    <action
        path="/content/UpdateTitle"
        type="org.dhsinfo.content.doSomething1"
        name="editTitleForm"
        scope="request"
        validate="true"
        input=".frame.content">
       <forward
           name="success"
           path=".title.Confirmation"/>
    </action>

3. I have this <form-bean> inside the <form-beans>
element in the struts-config.xml file:

<form-bean
name="editTitleForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property
name="page"
type="java.lang.String"/>
<form-property
name="title"
type="java.lang.String"/>
</form-bean>


4. I have the validation.xml file in the
AppName/WEB-INF directory

4.1. I changed the beginning of the validation.xml
file to
"http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd";
):

4.2 my validation.xml file code is shown below

I got the HTTP Status 500 -
Servlet.service() for servlet action threw exception

java.lang.ClassCastException org.apache.struts.validator.DynaValidatorForm.validate(DynaValidatorForm.java:141)

code:

<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE form-validation PUBLIC
"-//Apache Software Foundation//DTD Commons
Validator Rules Configuration 1.0//EN"
"http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd";>
<form-validation>
<global>
<constant>
<constant-name>postalCode</constant-name>
<constant-value>^\d{5}\d*$</constant-value> </constant>
</global>


  <formset>

<form name="editTitleForm">
<field
property="page"
depends="required">
<arg0 key="request.page"/>
</field>
<field
property="title"
depends="required">
<arg0 key="insert.title"/>
</field>
</form>
</formset>
</form-validation>


It appears as though the problem is with your use of a form-property called "page" - based on what I am seeing around line 141 of the DynaValidatorForm code, if you have a property named page, it MUST be an integer, otherwise classcastexception is thrown.

I'm guessing this is to accomodate "paged" forms (aka wizards)

Try changing the property to have another name, and I think it will fix your problem.


Matt

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



Reply via email to