You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Josh <jr...@yahoo.com> on 2001/02/13 17:26:45 UTC

Class BaseHandlerTag

I am trying to understand the BaseHandlerTag in the package
org.apache.struts.taglib.html and in particular the events.  For example when
and how would one go about using "getOnclick()"?  I would think that there is
some example code lying around which could answer many of my questions.  I am
running the struts-example program, which has been very helpful, however it
does not seem to be utilizing any of the events in the BaseHandlerTag (or am I
wrong?).  I will continue to search for some example code to illustrate uses
for these events, but in the meantime if people subscribe to this list could
post any links to follow I would appreciate it.

Thanks,
Josh



__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

Re: Class BaseHandlerTag

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

> I am trying to understand the BaseHandlerTag in the package
> org.apache.struts.taglib.html and in particular the events.  For example when
> and how would one go about using "getOnclick()"?

You probably would not be using this, which is probably leading to your confusion
:-).

Technically, custom tags only need setter methods for their properties, because
that is all the JSP page compiler needs.  I put getters in by programming habit,
and have found them to be useful in case of nested tags (a tag can find out who
its immediate parent is, and call property getters on that tag instance as if it
were a bean).

>  I would think that there is
> some example code lying around which could answer many of my questions.  I am
> running the struts-example program, which has been very helpful, however it
> does not seem to be utilizing any of the events in the BaseHandlerTag (or am I
> wrong?).  I will continue to search for some example code to illustrate uses
> for these events, but in the meantime if people subscribe to this list could
> post any links to follow I would appreciate it.
>

If you wanted to pop up an alert box when a button was clicked, you might say
something like (I'm not a JavaScript maven, so forgive any incorrect syntax):

    <html:button value="Click Me!"
     onclick='alert("I was clicked!")'/>

which will cause an "onclick" event handler to be included on the generated button
tag.  The same goes for all the other event handlers -- they just pass through
corresponding attributes on the generated HTML elements.

>
> Thanks,
> Josh
>

Craig