You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jacob Thomas <jt...@vitria.com> on 2001/04/18 04:46:10 UTC

How to avoid hardcoding image path in table

When creating a table row,  is there a way to avoid having to specify the
context name in the path for images as shown below:
           
   <td background="<context-name>/images/table_top_chip.gif" width="30" > 
    </td>

<html:base/> does not seem to be sufficient for this purpose. Also, using
relative path is not preferred for the application since the pages can move
around.
--
Thanks
Jacob


Re: How to avoid hardcoding image path in table

Posted by Ted Husted <hu...@apache.org>.
There aren't any Struts tags for writing tables (at least not yet ;-),
but one workaround would be to try a standard JSP expression, like 

background="<%=request.getContextPath()%>/images/table_top_chip.gif%>"

Jacob Thomas wrote:
> 
> When creating a table row,  is there a way to avoid having to specify the
> context name in the path for images as shown below:
> 
>    <td background="<context-name>/images/table_top_chip.gif" width="30" >
>     </td>
> 
> <html:base/> does not seem to be sufficient for this purpose. Also, using
> relative path is not preferred for the application since the pages can move
> around.
> --
> Thanks
> Jacob