Solved

Style Sheet Link Relative Absolute paths

Posted on 2004-09-15
6
417 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
  • 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

In this article, I will show you HOW TO: Create your first Windows Virtual Machine on a VMware vSphere Hypervisor 6.5 (ESXi 6.5) Host Server, the Windows OS we will install is Windows Server 2016.
Is your company's data protection keeping pace with virtualization? Here are 7 dynamic ways to adapt to rapid breakthroughs in technology.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now