File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes new errors! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "new errors!" Watch "new errors!" New topic

new errors!

kumar nagur

Joined: Oct 22, 2003
Posts: 9
hai everybody, I have java in "c" & tomcat also in "c" I wrote a servlet and compiled it .Now I got the class file. Now I moved the class fileto: C:\Tomcat 5.0\webapps\servlets-examples\WEB-INF\classes Afterwards I don't know what to do to run a servlet? (somebody told me to include servlet in C:\Tomcat 5.0\webapps\servlets-examples\WEB-INF\web.xml, like <servlet-mapping> <servlet-name>HelloWorld</servlet-name> <url-pattern>/servlet/HeeloWorld</url-pattern> </servlet-mapping> when I tried to do I am getting errors in Tomcat server.) so please help me out. I am in confusion. I appreciate u r help. Thank you.
Sri Basavanahally
Ranch Hand

Joined: Oct 07, 2003
Posts: 75
What does your servlet do ? Does it generate an HTML response ? If so, you need to type in something like:
http://localhost ortnumber/context/servlet/servletname to run it.
You need to have a web.xml file under your WEB-INF directory. This should include servlet-name, context name etc. look for a samples like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
<display-name>Webdav Content Management</display-name>
Webdav Content Management
<!-- Uncomment this to enable read and write access -->
<!-- The mapping for the webdav servlet -->

kumar nagur

Joined: Oct 22, 2003
Posts: 9
Thank you sri for u r response.
u r right I want get a HTML response.
but when ever I include
in my C:\Tomcat 5.0\webapps\servlets-examples\WEB-INF\web.xml document and save it.Then once again when I try to start the Tomcat I am getting errors .
And I couldn't be able to run the servlet too

I am doing like this in the browser
and I am getting a error page.
kumar nagur

Joined: Oct 22, 2003
Posts: 9
sorry ,like this
kumar nagur

Joined: Oct 22, 2003
Posts: 9
please help me out!!
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13036
I don't see where you tell us what error you actually get.
You seem to be mixing URL styles here - using a url with "/servlet/" is going to direct the requests to the "invoker" servlet if it happens to be turned on in the particular web application.
It looks like you didn't put your servlet class in a package - that can cause lots of trouble.
Tomcat 5 is still in beta, isn't it?
I agree. Here's the link:
subject: new errors!
It's not a secret anymore!