Tomcat acting different between Linux and Windows-XP

J

JAVA Rookie

Hi, all:
I have a sample servlet in Windows-XP and Linux, below is the modified section
in web.xml:

<servlet>
<servlet-name>
hi
</servlet-name>
<servlet-class>

<servlet-mapping>
<servlet-name>
hi
</servlet-name>
<url-pattern>
/hello.html
</url-pattern>
</servlet-mapping>

When I typed http://localhost:8080/hello.html in Windows-XP, I can got correct
page, but HTTP Status 404 - /hello.html under Linux? They do have same web.xml
and same configuration.

So what I need to do in Linux to make servlets working? And should I need to use
JSP instead of servlet? because I am learning servlet now and soon will be JSP.

Thanks in advance.
 
S

Sudsy

JAVA Rookie wrote:
When I typed http://localhost:8080/hello.html in Windows-XP, I can got correct
page, but HTTP Status 404 - /hello.html under Linux? They do have same web.xml
and same configuration.

So what I need to do in Linux to make servlets working? And should I need to use
JSP instead of servlet? because I am learning servlet now and soon will be JSP.

Check to see whether there is a file called
$TOMCAT_HOME/webapps/ROOT/hello.html on your XP box.
Generally speaking, HTML files aren't even processed
by the servlet engine. Try changing your mapping to
just hello (i.e. without the .html extension) and
see what happens.
 
J

Java, Linux and Life

Thanks, it works.
Interesting, those examples from book are all adding .html at mapping section
even there is no such html file exist.
 

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,763
Messages
2,569,562
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top