struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paradis, André" <andre.para...@versalys.com>
Subject RE: <html:img.../> and Javascript; Templates
Date Fri, 17 Aug 2001 14:46:59 GMT
>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