Servlet question(Tomcat, web.xml, servlet-class, servlet-name)

  • Thread starter circuit_breaker
  • Start date
C

circuit_breaker

Hi everyone,

I just upgraded from a 4.1.10 Tomcat implementation on NT4 to a Tomcat
5.0.19 on Linux. Works fine but...

On the NT4 box, my web.xml look like this:
---
<servlet>
<servlet-name>Testing</servlet-name>
<servlet-class>TestingServlet</servlet-class>
</servlet>
---

and I can call the servlet this way:
http//ntgate:8090/myApp/servlet/Testing

On the Linux box, I have something like this:
---
<servlet>
<servlet-name>TestingServlet</servlet-name>
<servlet-class>TestingServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TestingServlet</servlet-name>
<url-pattern>/servlet/TestingServlet</url-pattern>
</servlet-mapping>

When I call the servlet, I have to type "TestingServlet" in the URL in
order to have it working. If I change "TestingServlet" for "Testing"
in my web.xml file, the servlet doesn't show up.

What's the trick?

Thanks you.
 
S

Stefano

circuit_breaker said:
Hi everyone,

I just upgraded from a 4.1.10 Tomcat implementation on NT4 to a Tomcat
5.0.19 on Linux. Works fine but...

On the NT4 box, my web.xml look like this:
---
<servlet>
<servlet-name>Testing</servlet-name>
<servlet-class>TestingServlet</servlet-class>
</servlet>
---

and I can call the servlet this way:
http//ntgate:8090/myApp/servlet/Testing

On the Linux box, I have something like this:
---
<servlet>
<servlet-name>TestingServlet</servlet-name>
<servlet-class>TestingServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TestingServlet</servlet-name>
<url-pattern>/servlet/TestingServlet</url-pattern>
</servlet-mapping>

When I call the servlet, I have to type "TestingServlet" in the URL in
order to have it working. If I change "TestingServlet" for "Testing"
in my web.xml file, the servlet doesn't show up.

What's the trick?

Thanks you.

Did you restart tomcat to apply modifications?
 
J

Jack Jia

You should change url-pattern. Whatever you type in your browser is a url,
right?

Jack
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top