Use the <s:url> tag to generate the URL to the css file, this will
ensure it has the correct context.

Like this:
<link rel="stylesheet" type="text/css" href="<s:url
value='/css/intrabib.css' />" />

This will generate the correct path even if you deploy your app in a
context other then root.


On Wed, Jun 2, 2010 at 9:36 AM,  <ch...@chrismiles.org> wrote:
> It would make sense to use absolute links rather than relative ones. Your
> CSS folder you shoudl put on your root and always link to it with
> "/css/blah.css" and the same with images then you wont get into directory
> problems.
>
> Chris
>
>> You should not call your page from a link but always go through an action.
>> It is more secure and also it would solve your problem.
>>
>> Nevertheless, one solution is to use the <s:url> tag.
>>
>> Cimballi
>>
>>
>> On Wed, Jun 2, 2010 at 3:12 AM, Guy Thomas <guy.tho...@vlaamsbrabant.be>
>> wrote:
>>> Hallo,
>>>
>>> On a jsp page booksearchresult.jsp I have added a link to a stylesheet
>>> in the html-header:
>>>
>>> <link href="css/intrabib.css" ...
>>>
>>> This jsp page is sometimes displayed as the "result" of a struts action
>>> (case A):
>>>
>>> <action name="boekzoekerresultaten" class="bookSearch">
>>>  <result name="success">
>>>     <param name="location">/apps/intrabib/booksearchresult.jsp</param>
>>>  </result>
>>>
>>>  ...
>>> </action>
>>>
>>> sometimes as the result of a link (case B):
>>>
>>> http://localhost:8080/intrabib/apps/intrabib/booksearchresult.jsp?...
>>>
>>> The css folder is in the folder where the jsp pages are.
>>>
>>> The way the stylesheet is referred above, it only works in case B. I can
>>> change the stylesheet reference so that it works for case A, but then it
>>> doesn't work for case B anymore.
>>>
>>> I'm having similar problems with image references.
>>>
>>> The question is how I have to refer in a Struts2 environment to
>>> resources on a jsp page so that they are found whether this page that is
>>> the result of a Struts2 action or the result of a direct link.
>>>
>>> Thank you,
>>>
>>> Guy Thomas
>>>
>>>
>>>
>>> -------------
>>> Aan dit bericht kunnen geen rechten worden ontleend. Alle berichten naar
>>> dit professioneel e-mailadres kunnen door de werkgever gelezen worden.
>>> Ondernemingsnummer: 0253.973.219
>>>
>>>
>>
>>
>>
>> --
>> Cimballi
>> JAVA J2EE Freelance
>> http://javajeeleader.elance.com/
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

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

Reply via email to