Solved

Style Sheet Link Relative Absolute paths

Posted on 2004-09-15
6
428 Views
Last Modified: 2010-04-01
Project structure:
webApplication
\-images
\-jsp
\\-includes (sub of jsp)
\\-test1
\\\test2.jsp (jsp in test1 dir)
\\-test2
\-classes

In my web xml, I have test2.jsp mapped to new url test2

In my jsp page, only this link will make certain style sheet is ALWAYS used regardless of the URL entered by user:
<LINK href="/MYAPP/stylesheets/screen.css" rel="stylesheet" type="text/css">
Works for the following two URL's:
http://localhost:9080/MYAPP/jsp/test1/test2.jsp
http://localhost:9080/MYAPP/test2.jsp

Anyway around using absolute path? Is this good practice?
0
Comment
Question by:Paullkha
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
6 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 12064816
<LINK href="<%= request.getContextPath() %>/stylesheets/screen.css" rel="stylesheet" type="text/css">

may be better...then it doesn't matter what you call your webapp :-)
0
 
LVL 2

Author Comment

by:Paullkha
ID: 12086865
But is must be absolute, right. Because of the mapping, no way around.
0
 
LVL 2

Author Comment

by:Paullkha
ID: 12086928
PS. This question is similar, maybe you would take a look.
http://experts-exchange.com/Web/Web_Languages/JSP/Q_21130549.html
0
 
LVL 35

Accepted Solution

by:
TimYates earned 75 total points
ID: 12087753
No, it can be relative to the JSP...  But the absolute one will be the same in every JSP...

Otherwise it would have to vary depending on what directory the JSP was in...
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Export JSON response data to Excel in IE9 3 96
Using Tomcat as raspberry pi java app server 13 279
ejb on wildfly 5 61
junit example issue 2 54
Determining the an SCCM package name from the Package ID
Invest in your employees with these five simple steps to improve employee engagement and retention.
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question