struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexandru BARBAT" <>
Subject RE: Struts validator
Date Mon, 04 Feb 2008 17:08:58 GMT

You can override method 
 public String getValidationKey(ActionMapping mapping,
                                   HttpServletRequest request) {..}

>From your ValidatorForm (it doesn't matter if it is dyna or not)

And return different validation keys for each button pressed.

Validation key identify the rules of validation.

The validation file will look then something like:

<form name="myAction_button1">
		 <!--if submit button 1 clicked, I validate the
following field>-->
		<field property="myProperty" depends="required">
			<msg name="required" key="error.key1" />

<form name="myAction_button2">
		<!--if submit button 2 clicked, I validate the following
		<field property="name" depends="myValidator">
			<msg name="myValidator"	key="error.key2" /> 


-----Original Message-----
From: Dave Newton [] 
Sent: Friday, February 01, 2008 6:29 PM
To: Struts Users Mailing List
Subject: RE: Struts validator

--- "Zhang, Larry (L.)" <> wrote:
> No, I am using struts 1.1,

Oh, wow.

Does validwhen[1] not exist in S1.1? You can always create a custom
as well if you find your validation stretches what's easy to do with the
existing validation configuration possibilities. You may also be able to
combine declarative validation (via XML) and Java-based validation, although
it's been a pretty long time since I've thought about that :)


[1] (about 1/3 of
the way down)

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message