The Artima Developer Community
Sponsored Link

Java Answers Forum
Servlet and Applet Communication

4 replies on 1 page. Most recent reply: Dec 2, 2002 12:12 AM by Amit

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 4 replies on 1 page
Amit

Posts: 23
Nickname: amitactsh
Registered: Nov, 2002

Servlet and Applet Communication Posted: Nov 22, 2002 1:33 AM
Reply to this message Reply
Advertisement
Hello friends ;
I am having one problem when I am trying to communicate a servlet with an applet. The actual problem is :
I am having an Applet and from that applet I am trying to access a .class file that I have kept in a .jar file. Now I am giving the address of the servletrunner (server) in the codebase of that applet and specifying the .class name as the code property and .jar file as the archive property of the applet tag. Now I have kept this servlet that contains this applet tag into the servletrunner(server) but I am not able to fetch it from the server in my browser.
So please tell me solution for this problem .
Thanks in advance.
Amit .


Charles Bell

Posts: 519
Nickname: charles
Registered: Feb, 2002

Re: Servlet and Applet Communication Posted: Nov 22, 2002 9:21 AM
Reply to this message Reply
I do not think you can do that from the applet becuase the resources available to the servlets and JSPs are not the same as those available to web pages and applets.


For a typical Tomcat installation, the files under WEB-INF directory are not available to web pages and applets.

The resources you describe are class files that are typically stored under
WEB-INF/classes
or WEB-INF/lib

So you have to make a copy of the class files where the web pages will see them.

Putting them in a jar archive is a good idea.

Charles

David Brown

Posts: 1
Nickname: daveb
Registered: Nov, 2002

Re: Servlet and Applet Communication Posted: Nov 24, 2002 3:03 PM
Reply to this message Reply
Hello, i'm having a similar but much simpler problem. under my tomcat "webapps" directory tree i have both /web that contains servlets and /beans that contain straight java class "bean" files. if i reference the "bean" classes' constructors and therefore the classes' variables and methods from any of the servlets. no problem here. but if i invoke an html file w/ <APPLET></APPLET> tags i get ClassNotFoundException. i get this error no matter where i place the applet class or how i package the applet class. i welcome all ideas, suggestions, rants or raves. thanx, david.

Jay Kandy

Posts: 77
Nickname: jay
Registered: Mar, 2002

Re: Servlet and Applet Communication Posted: Nov 25, 2002 6:09 PM
Reply to this message Reply
If your context path /web maps to $TOMCAT_HOME/webapps/web, your applet/jar can be right there assuming its a servlet (like http://hostname:xxxx/web/ServletName) that contains this applet. The Servlet class would be under $TOMCAT_HOME\webapps\web\WEN_INF\classes. Dont forget the codebase property. In this case it would be ".".

Amit

Posts: 23
Nickname: amitactsh
Registered: Nov, 2002

Re: Servlet and Applet Communication Posted: Dec 2, 2002 12:12 AM
Reply to this message Reply
Thanks Jay ;
I think your suggestion will be going to help to overcome the problem.
Thanks.
Amit

Flat View: This topic has 4 replies on 1 page
Topic: Using a method in another method Previous Topic   Next Topic Topic: proxy java program, Problem with the images

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use