Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to Run a Servlet in Apache Tomcat

 
Silvester Stalin Bruno
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to run a servlet in Apache Tomcat. But, it's not working.

I followed the steps given in Head First Servlet and JSP.
1. I created a folder ch1 under Tomcat/webapps
2. I placed my servlet class under ch1/WEB-INF/classes
3. I placed web.xml file under ch1/WEB-INF.

<?xml version="1.0" encoding="ISO-8851-1" ?>
<web-app xmlns="http://www.sun.java.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sun.java.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<servlet>
<servlet-name>Chapter1 Servlet</servlet-name>
<servlet-class>Ch1Servlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>Chapter1 Servlet</servlet-name>
<url-pattern>/Serv1</url-pattern>
</servlet-mapping>

</web-app>

But, when i try hitting the page http://localhost:8080/ch1/Serv1, i get IE can not display the page.

Please advise, if i missed anything.

I am running Tomcat5 service in Windows Vista. And i have tomcat in "C:\Program Files\Apache Software Foundation\Tomcat".
 
Silvester Stalin Bruno
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

It's working now.

I changed the encoding value in web.xml to "ISO-8859-1" from "ISO-8851-1"
<?xml version="1.0" encoding="ISO-8859-1"?>

Thanks,
Stalin
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic