Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Style Sheet Link Relative Absolute paths

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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

It’s time for spooky stories and consuming way too much sugar, including the many treats we’ve whipped for you in the world of tech. Check it out!
If something goes wrong with Exchange, your IT resources are in trouble.All Exchange server migration processes are not designed to be identical and though migrating email from on-premises Exchange mailbox to Cloud’s Office 365 is relatively simple…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

609 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