On Wed, Sep 23, 2009 at 8:42 PM, John Vance <appfuse.t.jva...@xoxy.net>wrote:

>
> AAAANNNNDDD...  It works!
>
> With some gotchas.
>
> There is an architectural mismatch between the Commons Validator and
> Spring.
> Struts (which it was designed for) passes an ActionForm to the validator,
> which is populated with the string values that were submitted from the
> browser form - it's a DTO.  Spring passes a populated command object to the
> validator, which is a model object.  Any type mismatches / type conversions
> have already been caught and handled.
>
> I have checkboxes that are backed by Booleans (as generated by AMP).  When
> the ValidWhen rule parses out the form, the checkboxes have already been
> converted to Booleans.  The ValidWhen parser calls the toString() method on
> Booleans.  So the literal you're comparing the Boolean with would be either
> "true" or "false".
>
> Like so:
>
> <var>
>   <var-name>test</var-name>
>    <var-value>((isChecked == "false") or (*this* != null))</var-value>
> </var>
>
> Of course, since springmodules' commons validator adaptation is a stale
> mishmash of Commons Validator 1.1 and 1.3, it's kinda broken - especially
> the javascript (not handling multiple radio buttons is just one problem).
> I've smacked around the JavascriptValidatorTag to 1.3-ify it and updated
> the
> validator-rules.xml so it uses the newer js validation functions, but
> really, it's time for Appfuse and the rest of the world to move on.
>
> Spring Javascript integration into Appfuse, anyone?
>

Yes, I'm more than happy to introduce a better client-side validation system
in AppFuse. Maybe something that leverages JSR-303 and the preferred JS
framework of the week (not sure what that is these days). ;-)

Matt

Reply via email to