problem with Applet Servlet communication

Hi All,

i am very new to java and servlets......

i am using a applet to call a servlet whose .class file is stored in WEB_INF/classes directory of tomcat..

so what URL address i should use in the new URL( ) constructor ?

presently i have done in this manner..

URL urlServlet = new URL("http://l0.0.2.65:8080/myapp.ServletDB");

URLConnection con = urlServlet.openConnection();

where ServletDB is the name of the servlet .class file

whose address is as follows...

C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\myapp\WEB-INF\classes\ServletDB.class

Please help me....

thank you in advance

vijay

[687 byte] By [Mr.VijayDesai@OPSPLa] at [2007-11-27 10:39:24]
# 1

http://e-docs.bea.com/wls/docs61/webapp/web_xml.html

Look under the sections on Servlet Element and Servlet mapping.

tolmanka at 2007-7-28 19:00:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Specify Servlet Mapping in web.xml and use that mapped URL

<servlet>

<servlet-name>getItems</servlet-name>

<servlet-class>myapp.ServletDB</servlet-class>

</servlet>

<servlet-mapping>

<servlet-name>getItems</servlet-name>

<url-pattern>/ServletDB</url-pattern>

</servlet-mapping>

look at servlet mapping- url-pattern

Now u should use that mapped url while creating URL connection

here is the code.

URL urlServlet = new URL("http://l0.0.2.65:8080/ServletDB");

URLConnection con = urlServlet.openConnection();

Sudhir Nimavat

http://www.jYog.com

Sudhir_nimavata at 2007-7-28 19:00:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...