You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Hubert Rabago <hr...@gmail.com> on 2006/02/23 15:06:18 UTC

[shale] Commons Validation support

A teammate of mine was looking at Shale's support for Commons
Validator, and I noticed that the validation parameters are specified
as tag attributes:

<s:commonsValidator
    type="floatRange"
    min="10"
    max="1000"
    arg="#{messages['prompt.amount']}"
    server="true"
    client="true"/>

This would, of course, limit the possible params that can be
specified.  Can we change it to something like this instead?

<s:commonsValidator
    type="floatRange"
    arg="#{messages['prompt.amount']}"
    server="true"
    client="true">
    <s:validatorVar name="min" value="10"/>
    <s:validatorVar name="max" value="1000"/>
</s:commonsValidator>

Hubert

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


Re: [shale] Commons Validation support

Posted by Hubert Rabago <hr...@gmail.com>.
I suppose I should clarify that I tried this out last night and it
worked for me.

To make it work, I had to cheat with the ValidatorTag subclass and
move the call to createValidator() from the doStartTag() to the
doEndTag(), by overriding doStartTag() to do nothing, and calling
super.doStartTag() in the doEndTag() method.

I used the usecases sample app's validator test page to try it, and
used the updated date validator that came with JCV 1.2.0.  I was able
to use an updated date validator with "datePattern" (non-strict)
support.

Hubert

On 2/23/06, Hubert Rabago <hr...@gmail.com> wrote:
> A teammate of mine was looking at Shale's support for Commons
> Validator, and I noticed that the validation parameters are specified
> as tag attributes:
>
> <s:commonsValidator
>     type="floatRange"
>     min="10"
>     max="1000"
>     arg="#{messages['prompt.amount']}"
>     server="true"
>     client="true"/>
>
> This would, of course, limit the possible params that can be
> specified.  Can we change it to something like this instead?
>
> <s:commonsValidator
>     type="floatRange"
>     arg="#{messages['prompt.amount']}"
>     server="true"
>     client="true">
>     <s:validatorVar name="min" value="10"/>
>     <s:validatorVar name="max" value="1000"/>
> </s:commonsValidator>
>
> Hubert
>

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


Re: [shale] Commons Validation support

Posted by Craig McClanahan <cr...@apache.org>.
On 2/23/06, Hubert Rabago <hr...@gmail.com> wrote:
>
> A teammate of mine was looking at Shale's support for Commons
> Validator, and I noticed that the validation parameters are specified
> as tag attributes:
>
> <s:commonsValidator
>     type="floatRange"
>     min="10"
>     max="1000"
>     arg="#{messages['prompt.amount']}"
>     server="true"
>     client="true"/>
>
> This would, of course, limit the possible params that can be
> specified.  Can we change it to something like this instead?
>
> <s:commonsValidator
>     type="floatRange"
>     arg="#{messages['prompt.amount']}"
>     server="true"
>     client="true">
>     <s:validatorVar name="min" value="10"/>
>     <s:validatorVar name="max" value="1000"/>
> </s:commonsValidator>


This is definitely an idea worth exploring.  Could you please open a
Bugzilla RFE issue for it?

http://issues.apache.org/bugzilla/

Hubert


Craig