Style Sheet Link Relative Absolute paths

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

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:

Anyway around using absolute path? Is this good practice?
Question by:Paullkha
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
LVL 35

Expert Comment

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 :-)

Author Comment

ID: 12086865
But is must be absolute, right. Because of the mapping, no way around.

Author Comment

ID: 12086928
PS. This question is similar, maybe you would take a look.
LVL 35

Accepted Solution

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...

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
getting param value 7 59
using if condition without JSTL 2 115
Looking for some programs to resell or buy source codes 1 78
thymeleaf natural templating vs JSP 2 162
While it may be true that the internet is a place of possibilities, it is also a hostile environment lurking with many dangers. By clicking on the wrong link, trusting the wrong person or using a weak password, you are virtually inviting hackers to …
This article demonstrates probably the easiest way to configure domain-wide tier isolation within Active Directory. If you do not know tier isolation read…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

756 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