"Deadman, Hal" wrote:
 I am using the Struts html:img tag and I just moved my app from the root context to a different context. All the other Struts links I have seem to have prepended the context name in the link. The image tag didn't. Am I doing something wrong?this jsp:<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> <html:img src="/image/odtos_logo.gif" alt=""/>  generated: 
<img src="/image/odtos_logo.gif" alt="">  when the context root in the application.xml of my ear file is: <context-root>odtos</context-root>shouldn't it generate:<img src="/odtos/image/odtos_logo.gif" alt="">Thanks, Hal


The "src" attribute of the <html:img> tag is essentially copied unchanged (other than URL encoding), which means you would want to use a relative path to be independent of the context path you are deployed under.  This is consistent with the way that <html:link> treats the "href" attribute.

However, the <html:link> tag also offers the "page" attribute, which lets you specify a context-relative path, and Struts will add the context path for you.  How about if we add a "page" attribute to <html:img>, as an alternative to the "src" attribute, so you can have it either way?

Craig
 

Reply via email to