You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Chaudhary, Harsh" <HC...@amfam.com> on 2007/02/13 22:24:56 UTC

Struts 1.3 pain

I am trying to convert a Struts 1.2 app to Struts 1.3.

Method definitions for custom validation in validator-rules.xml

Struts 1.2 Version

<validator name="required"
classname="org.apache.struts.validator.FieldChecks"
method="validateRequired"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionMessages,
javax.servlet.http.HttpServletRequest"
msg="errors.required"/>

Struts 1.3 Version

<validator name="required"
classname="org.apache.struts.validator.FieldChecks"
method="validateRequired"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionMessages,
>>>>>>>>>org.apache.commons.validator.Validator,<<<<<<<<<
javax.servlet.http.HttpServletRequest"
msg="errors.required"/> 

 

In Struts 1.2 version I did not have to pass the Validator object for
the required field. But with 1.3 am being forced to do so, if not I get
a No Such Method Exception. Now that I have tweaked the "required"
validator, when I try to run my struts application, am getting a
org.apache.commons.validator.ValidatorException: No such validation
method: null exception. Digging into the error stack trace it says
java.lang.NullPointerException: No message resources found for bundle:
org.apache.struts.action.MESSAGE

I have the validator.xml, validator-rules.xml and errors.properties
intact from my Struts 1.2 version.

Any thoughts or ideas of what am doing wrong.

Harsh.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Struts 1.3 pain

Posted by "Chaudhary, Harsh" <HC...@amfam.com>.
I will try that.
Thanks a lot for your input.

Harsh.

-----Original Message-----
From: Christopher Schultz [mailto:chris@christopherschultz.net] 
Sent: Tuesday, February 13, 2007 5:05 PM
To: Struts Users Mailing List
Subject: Re: Struts 1.3 pain


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Harsh,

Chaudhary, Harsh wrote:
> There is no specific reason, But we have one custom validation, So is
it
> good practice to revamp the entire the validator.xml file then?

Well, there's no reason to put everything into one file. I had this same
problem (upgrading between commons-validator releases, and from Struts
1.2 to 1.3), and then I read that you can use more than one file.

Now, I have this in my struts-config.xml:

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

Note that you can use the stock validator-rules.xml file directly from
within the JAR file that it comes with.

Just add your own rules file after that. Then, at least, you only have
to update your own file (and source files as well) when you upgrade.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF0kQj9CaO5/Lv0PARAuzPAKClljgIqBGsTdPN/zrlVypgqKQoRQCgs+P2
fk4WAxDk8zAQaYY/8LEj9eg=
=8C+F
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts 1.3 pain

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Harsh,

Chaudhary, Harsh wrote:
> There is no specific reason, But we have one custom validation, So is it
> good practice to revamp the entire the validator.xml file then?

Well, there's no reason to put everything into one file. I had this same
problem (upgrading between commons-validator releases, and from Struts
1.2 to 1.3), and then I read that you can use more than one file.

Now, I have this in my struts-config.xml:

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

Note that you can use the stock validator-rules.xml file directly from
within the JAR file that it comes with.

Just add your own rules file after that. Then, at least, you only have
to update your own file (and source files as well) when you upgrade.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF0kQj9CaO5/Lv0PARAuzPAKClljgIqBGsTdPN/zrlVypgqKQoRQCgs+P2
fk4WAxDk8zAQaYY/8LEj9eg=
=8C+F
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Struts 1.3 pain

Posted by "Chaudhary, Harsh" <HC...@amfam.com>.
There is no specific reason, But we have one custom validation, So is it
good practice to revamp the entire the validator.xml file then?

Any other gotchas from someone who has migrated a 1.2 app to 1.3?

Harsh.

-----Original Message-----
From: Christopher Schultz [mailto:chris@christopherschultz.net] 
Sent: Tuesday, February 13, 2007 4:10 PM
To: Struts Users Mailing List
Subject: Re: Struts 1.3 pain


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chaudhary,

Chaudhary, Harsh wrote:
> I am trying to convert a Struts 1.2 app to Struts 1.3.

[snip]

> I have the validator.xml, validator-rules.xml and errors.properties
> intact from my Struts 1.2 version.

Is there a reason to keep your old validator.xml file? Why not just
overwrite the one you have with the new one?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF0jdC9CaO5/Lv0PARAucpAKCRudkIjz5pyv24P7GQeqdssmi9FwCdHfIg
I6fYBhZTOfBGwZuLbLNVrjE=
=673S
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts 1.3 pain

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chaudhary,

Chaudhary, Harsh wrote:
> I am trying to convert a Struts 1.2 app to Struts 1.3.

[snip]

> I have the validator.xml, validator-rules.xml and errors.properties
> intact from my Struts 1.2 version.

Is there a reason to keep your old validator.xml file? Why not just
overwrite the one you have with the new one?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF0jdC9CaO5/Lv0PARAucpAKCRudkIjz5pyv24P7GQeqdssmi9FwCdHfIg
I6fYBhZTOfBGwZuLbLNVrjE=
=673S
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org