- Joined
- Aug 23, 2007
- Messages
- 2
- Reaction score
- 0
Hi,
This evening, I was upgrading from an older version of Apache to a latest Tomcat 5.5 version. I had a web project with over 20+ servlets that are part a of a package.
This evening, I was able to get a working example going to test an example servlet which seems to work based upon some information I have read here. This is what I have defined in my web.xml file under my context root directory.
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlnssi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<servlet>
<servlet-name>TestMe</servlet-name>
<servlet-class>com.abc.test.TestMe</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TestMe</servlet-name>
<url-pattern>/Testing</url-pattern>
</servlet-mapping>
</web-app>
I then called:
http://localhost:8080/content/Testing
My test servlet class "TestMe" is within package com.abc.test.TestMe. After thinking about the 20+ servlets I have in my older project, I became curious as to whether I will need to specify a definition for each one of those servlets in my web.xml file?
Previously, I could call any serlvet of such below where I could just create my servlet without having to define as I am doing now or having to do:
/servlets/com.abc.test.Servlet1
/servlets/com.abc.test.Servlet2
/servlets/com.abc.test.Servlet3
etc
...
Is there an easier way to do this without having to update the web.xml file each time I create a servlet?
Thanks for the help,
Steven Mac
This evening, I was upgrading from an older version of Apache to a latest Tomcat 5.5 version. I had a web project with over 20+ servlets that are part a of a package.
This evening, I was able to get a working example going to test an example servlet which seems to work based upon some information I have read here. This is what I have defined in my web.xml file under my context root directory.
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlnssi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<servlet>
<servlet-name>TestMe</servlet-name>
<servlet-class>com.abc.test.TestMe</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TestMe</servlet-name>
<url-pattern>/Testing</url-pattern>
</servlet-mapping>
</web-app>
I then called:
http://localhost:8080/content/Testing
My test servlet class "TestMe" is within package com.abc.test.TestMe. After thinking about the 20+ servlets I have in my older project, I became curious as to whether I will need to specify a definition for each one of those servlets in my web.xml file?
Previously, I could call any serlvet of such below where I could just create my servlet without having to define as I am doing now or having to do:
/servlets/com.abc.test.Servlet1
/servlets/com.abc.test.Servlet2
/servlets/com.abc.test.Servlet3
etc
...
Is there an easier way to do this without having to update the web.xml file each time I create a servlet?
Thanks for the help,
Steven Mac