struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: Validating bean properties (WAS: Re: Stupd question aboutStruts and EJB.)
Date Thu, 01 Mar 2001 04:06:11 GMT
Nick Pellow wrote:

> I was considering an approach where coders wrote validation code in Java
> (we all know java!)
> yet the Struts framework executed it. You would extend or implement a
> common java class/interface defining a single method,
> public ValidationErrors validate();  say.
> That is then mapped to the form field in an xml file somewhere.
> Struts, however could ship all the standard validations (such as Strings
> to ints)
> together.
> It is something I have not given much thought to yet, but would be
> interested in
> exploring further.

Beyond the thinking expressed so far on this thread, I've had two additional ideas
for functionality that should be included here:

* Optional generation of client-side JavaScript code to do the kinds
  of validations that make sense (required fields, number formats, etc.)
  closer to the user.

* The JavaBeans spec includes the concept of a PropertyEditor, which
  lets you define a custom conversion between String and a bean data type.
  JSP 1.2 supports this when doing attribute conversions -- we should look
  at whether it can help us in the conversion/validation arena as well.

Craig McClanahan

View raw message