You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Craig R. McClanahan" <Cr...@eng.sun.com> on 2001/03/01 05:06:11 UTC

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



Re: Validating bean properties (WAS: Re: Stupd question aboutStruts and EJB.)

Posted by Spencer Smith <sp...@newdestiny.net>.
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" <Cr...@eng.sun.com>
To: <st...@jakarta.apache.org>
Cc: <st...@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
>
>
>


Re: Hook to bootstrap in Tomcat

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Qiqi Dong wrote:

> Does anyone know how to bootstrap my own classes when start Tomcat. Does
> Tomcat actually provide a hook for that?

Qiqi, the best place to ask this is on the TOMCAT-USER list, rather than the
two lists you selected.

However, to save the trouble of re-asking, the answer varies by Tomcat
version:

* In Tomcat 3.x (based on servlet 2.2), about the only way
  to bootstrap your own classes is to create an initialization
  servlet, and mark it <load-on-startup>.  Then, in the init()
  method of this servlet, instantitate and configure your user
  objects as needed.

* In Tomcat 4.0 (based on servlet 2.3), you can do the above.
  Or, you can use the new "application event listeners" model
  to create an object that is notified when your webapp is started
  (and shut down), and can perform appropriate initialization
  for you.

Craig McClanahan



Hook to bootstrap in Tomcat

Posted by Qiqi Dong <qd...@swbell.net>.
Does anyone know how to bootstrap my own classes when start Tomcat. Does
Tomcat actually provide a hook for that?




Hook to bootstrap in Tomcat

Posted by Qiqi Dong <qd...@swbell.net>.
Does anyone know how to bootstrap my own classes when start Tomcat. Does
Tomcat actually provide a hook for that?