?
Solved

Style Sheet Link Relative Absolute paths

Posted on 2004-09-15
6
Medium Priority
?
430 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 300 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

The Summer 2017 Scholarship Winners have been announced!
The top devops trends for 2017 are focused on improved deployment frequency, decreased lead time for change and decreased MTTR.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

752 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