Wrox Programmer Forums
|
Apache Tomcat General discussion of the Apache Tomcat servlet container. For discussions specific to the Professional Apache Tomcat book, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Apache Tomcat section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 16th, 2007, 06:32 AM
Registered User
 
Join Date: Aug 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Path problem

Hi,
I am using Apache Tomcat/5.5.9.
I am having problem accessing the CSS in my Jsp page.
My Directory structure is

TOMCAT_HOME/webapps/MyProject

MyProject/jsp/login.jsp
MyProject/css/global.css

I am using the following path to have the reference for the global.css and it is not importing the CSS.

<link href="/css/global.css" rel="stylesheet" type="text/css">

If I replace the above href as below, it works?
<link href="../css/global.css" rel="stylesheet" type="text/css">

Please site me what would be the reason.
Doess I have to use ../ to refer the sibling folder in a web application?

Regards,
Suresh.




 
Old September 4th, 2007, 06:13 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

Most of the developers will do the same kind of mistake. The first syntax has "/" in the href and it'll always point to http://localhost:8080/ which is the root for the tomcat. In the second syntax the "../" will consider the current directory and take one level up which is MyProject and tries to resolve the other part of the path.

General approach is to have the <base> tag which will point to the base directory of your application and all the other links in the jsp will use relative paths which will be resolved from the base directory given in the <base> tag. :-)

- Rakesh





Similar Threads
Thread Thread Starter Forum Replies Last Post
Bin, App_code path problem jo5h209 ASP.NET 2.0 Basics 2 August 2nd, 2007 07:31 AM
Implementing the all-path shortest path problem bitwords XSLT 1 December 6th, 2006 11:37 AM
problem with x-path expression ashyabhi_hp XSLT 3 February 1st, 2006 05:07 AM
DB Path problem creative_eye Classic ASP Databases 1 March 7th, 2005 11:14 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.