Solved

Style Sheet Link Relative Absolute paths

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Apache-Tomcat Single Sign On with NTLM/Kerberos on Windows 2008R2 3 216
bean mapper frameworks 5 60
grep code 4 183
java operators 3 114
In this article we will learn how to backup a VMware farm using Nakivo Backup & Replication. In this tutorial we will install the software on a Windows 2012 R2 Server.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

773 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