• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

url pattern

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello?

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
"
<url-pattern>/</url-pattern>
"
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!!!
Thanks!

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

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


<description>
Welcome!
</description>


<servlet>
<servlet-name>SessionLoginServlet</servlet-name>
<servlet-class>SessionLoginServlet</servlet-class>
</servlet>

<!-- Define the controller servlet -->
<servlet>
<servlet-name>ControllerServlet</servlet-name>
<servlet-class>ControllerServlet</servlet-class>
</servlet>


<!-- Define the controller servlet -->

<servlet-mapping>
<servlet-name>SessionLoginServlet</servlet-name>
<url-pattern>/SessionLoginServlet</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>ControllerServlet</servlet-name>
<url-pattern>/ControllerServlet</url-pattern>
</servlet-mapping>



<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>



<!-- Security roles referenced by this web application -->
<security-role>
<role-name>role1</role-name>
</security-role>
<security-role>
<role-name>tomcat</role-name>
</security-role>


</web-app>
----------------------------------
[ October 07, 2004: Message edited by: misun chung ]
 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic