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:37:47 GMT
André Warnier wrote:
> 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.
> Hi.
> 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 
> "(tomcat-install-dir)/webapps/Servlet/DbServlet.jar"
> 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> tag.
> It is only after it has retrieved the applet, that the browser will 
> activate its Java run-time machine, to actually run the applet.
Sorry, it looks like I misunderstood the issue above.
 From what you write, it seems that the applet is being loaded by the browser - since you

can click on "it's button".
So you are getting a " error".  Where do you get that error 
message ? in the browser page returned by the server when you click on the applet button ?
If so, then it is your servlet (on the server side) that is getting that error.
And then /you/ have to find out why it is getting that error.
There would be nothing wrong with Tomcat. It is your application which makes the error happen.

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

View raw message