The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
November 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Heres what you need to do

Posted by Jay on November 07, 2001 at 8:36 AM

You have got the Context right. But have you registered the servlet in web.xml? If not, register this way:

<servlet>
<servlet-name>myServlet</servlet-name>
<servlet-class>ClassFileName</servlet-class>
</servlet>

Servlet-name is how you want to access the servlet and servlet-class is the actual class file name.

Note that thats this is what the servlet specification says.

You can not get rid of the entire "http://localhost:8080". You need to tell the browser which machine to make connection to right? So in your server.xml search for


<Connector className="org.apache.tomcat.service.PoolTcpConnector">
<Parameter name="handler"
value="org.apache.tomcat.service.http.HttpConnectionHandler"/>
<Parameter name="port"
value="8081"/>
</Connector>

and change 8081 (or what ever you have there) to 80.

This means you have to access your servlet using the URL "http://localhost:80/inquiry/servlet/myservletfilename". But as 80 is the default http port, you can just say:
"http://localhost/inquiry/servlet/myservletfilename".

Name your webserver and you could use that name instead of "localhost"

-Jay.



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us