struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: Interfaces vs base classes
Date Tue, 14 Nov 2000 13:27:07 GMT
Palamadai Sriram wrote:

> Error : Iam not allowed to use Java script , hope that clarifies

Is this restriction due to management or technical issues in your environment,
or are you perceiving a limitation in Struts that prevents this?

Struts, in and of itself, does not care whether or not you use JavaScript for
certain client side validations.  In fact, the form-based tags include event
handler attributes precisely so that you can define such validations.  Indeed,
future versions of Struts may support the automatic generation of JavaScript
validation functions for common cases.

If you are considering using JavaScript, you should also be aware of the

* Not every validation check can be done conveniently
  in a JavaScript function.  For example, it is not easy
  to go ask a database whether or not a particular value
  is already in use (and therefore not available).

* Even if you are using JavaScript for client side validations,
  you should *always* check everything again on the server
  side.  You have no guarantees that the client who submitted
  this request has JavaScript enabled, or even that they are
  using a browser.

For server side validation, Struts supports the following functionality (in
1.0), prior to calling your action method:

* The form bean's reset() method is called, which allows you
  to deal with things like checkboxes by resetting to default

* The property setters are called to reflect all of the input values
  submitted with this form.

* The validate() method of the form bean is called, which can
  perform any desired checks, and return a set of error messages.

* If any errors are detected by the validate() method, Struts
  returns control to the designated input form, *instead of*
  calling your action class.

* If no errors are detected, the appropriate action class is
  selected and the perform() method is executed.

Craig McClanahan

View raw message