File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes url pattern Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "url pattern" Watch "url pattern" New topic

url pattern

misun chung

Joined: Oct 07, 2004
Posts: 1

I got a problem with url pattern.
Here is my web.xml.
As you can see, I have two servlets, one for log-in and one for controlling the jsp pages. (test is the directory name of this application)
If I enter the url, "http://localhost:8080/test/SessionLogin" or "http://localhost:8080/test/ControllerServlet",
it works fine.
But I would like to use "http://localhost:8080/test"!

I tried several things, and found out that if I edit the url-pattern of either servlet like
then, I can't use relative path for images or styles.
For example,
I have the following codes in a jsp page.
"<!-- styles -->
<LINK REL="StyleSheet" HREF="style/style.css" TYPE="text/css" MEDIA=screen>

Any suggestion would be appreciate!!!

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"

<display-name>Intranet System </display-name>



<!-- Define the controller servlet -->

<!-- Define the controller servlet -->




<!-- Security roles referenced by this web application -->

[ October 07, 2004: Message edited by: misun chung ]
Manoj Gundawar
Ranch Hand

Joined: Nov 17, 2002
Posts: 169
I am not sure why you are doing that. May be you have your own reason. But
try using absolute path for images and CSS in your JSPs.
Ex. /APP_NAME/folder_name_of_CSS/Actual_Name_Of_CSS_File
[ October 07, 2004: Message edited by: Jmannu gundawar ]

I agree. Here's the link:
subject: url pattern
It's not a secret anymore!