File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes eventHandler in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "eventHandler in struts" Watch "eventHandler in struts" New topic

eventHandler in struts

fab etore

Joined: Jul 01, 2002
Posts: 9
i would like to use methods like setonclick, setonblur, for this sort of <html:text param="toto" name="tintin" />

This events have to be executed by my classe Action.
Exemple, if a girl is connected, the "model" will tell me the sex of the connected person and i will change the vue in fonction of that.
ex: maxlength=6 for a girl and maxlength=20 for a boy (for my field)
So i will call the methods, but i don't see how to implements them.
NB: i'm a beginner, in using struts.
Matthew Phillips
Ranch Hand

Joined: Mar 09, 2001
Posts: 2676
JavaRanch has a naming policy which is strictly enforced. Please read the policy and change your display name if you wish to continue posting here. Thanks.

Matthew Phillips
fab etore

Joined: Jul 01, 2002
Posts: 9
it is done.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

I think you're making the common error con confusing client-side programmming with server-side programming. "onblur", "onclick", etc. are options to attach client-side (JavaScript) code to the page.
In order to get a server-side action to be performed, you have to do an HTTP submit. This causes whatever form data (or URL-attached data) you specify to be sent to the appserver. If the URL decodes into a Struts request, it will then invoke the associated Action as well as doing any indicated validation/Form Bean operations - all of which are determined in struts-config.xml.
Once the Action has completed, it indicates the next View (JSP) to display, based on the processing that has been done.
Thus, only if you code a JavaScript form submit command (or something similar) in your onClick method can such a client-side operation cause any sort of action down in the Struts server.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: eventHandler in struts
It's not a secret anymore!