We had that problem, but got around it by doing the following in our main
site template:
<% String contextPath = request.getContextPath(); %>
Then when referencing an image or the css file just do the following:
<img src="<%=contextPath%>/images/someimage.gif" />
<link rel="stylesheet" href="<%=contextPath%>/css/all.css" type="text/css" />
This also made life easier in a team environment when people have multiple
copies of the applications running in their own context.
Hopefully that's what you were looking for.
Aaron
On Tue, 18 Dec 2001, Hudayioglu, Fehmi wrote:
> Sorry this is not an answer mail. But we are suffering almost from the same
> problem.
> when I call my jsp page directly, the page is displayed properly but when it
> is forwarded from an action bean (through the struts-config.xml of course),
> the page sucks literally. I don't know the reason. Of course there are some
> very indirect solution to this (declaring a new parameter in the web-xml
> (eg. Stylesheet_directory='jsp/xyz.css'). get it from each jsp by
> getparameter('stylesheet_directory') and precede this string to your style
> names.)
> Anyway, sometimes I feel that struts is unreliable and very open to
> unexpected results.
> thanks, I think, I need to have a crying session not only for this reason
> but for several reasons that I couldn't get any answer from this group.
>
>
>
> -----Urspr�ngliche Nachricht-----
> Von: Dave J Dandeneau [mailto:[EMAIL PROTECTED]]
> Gesendet am: Tuesday, December 18, 2001 4:46 PM
> An: Struts Users Mailing List
> Betreff: PLEASE: Image References in jsp
>
> Has anyone seen this behavior? We have an action that is used from a
> couple of different mappings. Depending on a parameter it displays
> differently. When forwarded to the
> jsp the images fail under different mappings. i.e. if it is
> "/reg/action1" then the images don't display, but if the action is
> called through "/action1" then all images display fine.
>
> All the images are in the root directory inside a directory called
> "images".
> We are referencing them via "/images/image.gif"
>
> Has anyone else had this problem? Is there a workaround?
>
> Thanks,
> David Dandeneau
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>