struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Spencer Smith" <spenc...@newdestiny.net>
Subject Re: Validating bean properties (WAS: Re: Stupd question aboutStruts and EJB.)
Date Fri, 02 Mar 2001 00:48:17 GMT
Help!

Question:

Is there a simple way to set an index for an error message so that I can
vary it's placement on my JSP Page?

// In Action

// old code
errors.add(ActionErrors.GLOBAL_ERROR, new
ActionError("caremanager.mp.error.phoneFormat"));

// new code (preferredDayPhone is my field name)
errors.add("preferredDayPhone", new
ActionError("caremanager.mp.error.phoneFormat"));

// In JSP

<font color="#ff0000"><eCMS:preferredDayPhone.errors/></font>  ???




----- Original Message -----
From: "Craig R. McClanahan" <Craig.McClanahan@eng.sun.com>
To: <struts-user@jakarta.apache.org>
Cc: <struts-dev@jakarta.apache.org>
Sent: Wednesday, February 28, 2001 8:06 PM
Subject: Re: Validating bean properties (WAS: Re: Stupd question aboutStruts
and EJB.)


> 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
>
>
>


Mime
View raw message