I was facing a problem since a very long time. Many a times when a request is made to my website, it doesn't gets properly rendered as if the CSS is not functioning and 3 weeks later I found the bug.
For adding CSS I was doing this :
<link rel="stylesheet" href="<s:url value="/"/>css/style.css" type="text/css">
due to which in case of the first request to my site it was rendered as
<link rel="stylesheet" href="/onlinexamples;jessionid=13241342154797/css/style.css" type="text/css">
As you can see above, due to the presence of jessionid the whole href url goes wrong. And with further subsequent requests, tomcat figured out that the cookies were enabled so it started rendering as
<link rel="stylesheet" href="/onlinexamples/css/style.css" type="text/css">
and hence from second request onwards everything worked fine.
The solution I applied is instead of using <s:url> I used EL's pageContext.request.contextPath as
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/style.css" type="text/css">
thanks a lot dear....you saved my time..thnks
ReplyDelete