tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: Java Applet can not communicate with Java Servlet
Date Mon, 29 Apr 2013 14:29:37 GMT
qingtao peng wrote:
>   I have built the apache-tomcat-7.0.32 server on my computer.My operating system is
Windows7.I have written  an Applet and compiled it .The  source code of the Applet is as follow

> This compiled Applet has been embedded in a HTML file named with DbApplet.htm.
> The  source code of the Servlet is as follow : 

> I have started the apache-tomcat-7.0.32 server ,then I have typed the network address
of DbApplet.htm in the  address field of the browser.I click on the button in the Applet,but
 receive error.The error is http://localhost:8080/Servlet/DbServlet.Where
do I place DbServlet ? That is, which directory  do I place under in apache-tomcat-7.0.32.
What is the network address of this Servlet .I thank for helps.


Simplify the problem.

1) In your HTML page, there is the tag that retrieves the applet from the server. What is

the URL from which the applet is being retrieved ?

2) if it is like "/Servlet/DbServlet", then the .jar file in which your compiled applet is

embedded, should be in the directory "(tomcat-install-dir)/webapps/Servlet/".

3) if it is indeed a .jar file, then it should be the file 
and you should be able to retrieve it if you enter the following URL in your browser's URL

bar : "http://localhost:8080/Servlet/DbServlet.jar"
(The browser will probably ask you where to save that file, it will not run it in this case).

Note: when the browser has retrieved your HTML page from the server, it sees the applet 
tag in the HTML page. It then makes another request to the server, to retrieve the applet

from the server in exactly the same way as if this was for example an image from an <img>
It is only after it has retrieved the applet, that the browser will activate its Java 
run-time machine, to actually run the applet.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message