struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jain, Shipra" <Shipra.J...@GTECH.COM>
Subject RE: <html:img.../> and Javascript; Templates
Date Fri, 17 Aug 2001 15:13:26 GMT
Thanks,  Andre for your reply.

You are recommending to write our own tag. I understand it, but our leads
doesn't want spend time on customization of the base frameworks ( they have
their own reasons ). Moreover, rollovers are not in there priority list.
What I was thinking that features like this might be in to do list for
Struts 1.1. Also, they might have already added it to the nightly builds. If
I can take the code right from there, it would be great. May be some one
from Struts Developer can answer this.

Anyway, thanks very much for your input. If I get some spare time from my
schedule, I'll surely try it out & let you know

Thanks
Shipra 

-----Original Message-----
From: "Paradis, André" [mailto:andre.paradis@versalys.com]
Sent: Friday, August 17, 2001 10:47 AM
To: struts-user@jakarta.apache.org
Subject: RE: <html:img.../> and Javascript; Templates


>Can you please expand on which sturts code you are talking
>about ( is it the nightly builds ? any specific dates? ). It would be
just
>great if you can specify which set of package/ classes I should take
from
>the nightly build & still not mess with the other code.
>I'm using struts 1.0.

I did'nt try this yet, but if you get the source of release 1.0, then
copy the content of org.apache.struts.taglib.html.ImgTag
in a file part of your project, say MyImgTag, it is then possible to add
the handling code for the missing javascript attributes.


In struts-html.tld, you have the following definition:

<snippet>

<tag>
<name>img</name>
<tagclass>org.apache.struts.taglib.html.ImgTag</tagclass>
<bodycontent>empty</bodycontent>
<attribute>
...

</snippet>


Just change the <tagclass> tag value to: com.wathever.MyImgTag and
restart your app.  You should also add attributes tags
to the struts-html.dtd with declarations like this one:

<attribute>
<name>onMouseOver</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>

In this way you can add as many attributes as you want.  Dont forget to
add corresponding attribute data member in the tag class
and modify the html code generation to print out the attribute and
attribute value. 

Maybe it's also possible to extend the struts img class instead of
copying and modifying the code in a new class file, but i did not look
at the code yet.

Hope it helps.  If you get it to work, drop me a line.

Andre


Mime
View raw message