You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by James CE Johnson <jc...@tragus.org> on 2003/03/18 16:05:21 UTC

A humble addition to html:img

Hello All,

I've recently been working on a reasonably complex application that has
several modules. Each module has its own struts config file and tiles
definition file. In addition, they also share a set of common global
forwards and tiles.

What I'm running into is that <html:img page="/foo"/> in any of my tiles
will cause /foo to be prefixed with both the context path and the module
prefix. That means that all of my images break in my modules. (Yes, I've
tried <html:img src="/foo"/> but that doesn't include any context path at
all.)

To overcome the problem I've modified my copy of ImgTag.java and
struts-html.tld to add a new attribute: contextRelative. This behaves
similarly to the contextRelative used in struts-config-*.xml in that it
removes the module prefix.

I suspect that not many people have run into this yet. After all, I've
been using struts and tiles for years and only just hit the problem last
week. It seems to arise when you're using multiple modules and tiles.
Specifically, when you have a global tiles definition that is in the
"scope" of the default module. I can describe my particular application
configuration in more detail if anyone is interested.

The patch is at http://www.tragus.org/~jcej/ImgTag.patch and I would
appreciate it if you would consider it for inclusion in the next struts
release.

Thanks,
J


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org