Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Include Applet tag in Java Servlet

Posted on 2002-07-14
3
Medium Priority
?
347 Views
Last Modified: 2013-11-24
Hi,

I am writing a programme using Servlet and I have to send a applet to client. So I place the applet tag in the html code in Servlet. However, when I viewed it in browser, it said ClassNotFound Exceptionand in a grey area where I suppose my applet should appear.

My servlet code fragment is as follow:

  response.setContentType("text/html");
  PrintWriter out = response.getWriter();

  out.print("<HTML>"+
         "<HEAD>"+                   "<TITLE>Auction</TITLE>"+
         "</HEAD>"+
         "<BODY>"+
            "<APPLET CODE=\"TemplateVarApplet.class\"  WIDTH=\"300\" HEIGHT=\"300\">"+
         "</APPLET>"+
         "</BODY>"+
         "</HTML>");
out.close();

I place my TemplateVarApplet.class in the same directory as this servlet code.
(both are in C:\Program Files\Apache Tomcat 4.0\webapps\fyp\WEB-INF\classes)

I have try adding codebase to the applet tag but it still can't work.

How to solve this ClassNotFoundException problem in Applet?

Any ideas?
         
Thanks a lot...^^

Sherina
0
Comment
Question by:sherina
  • 2
3 Comments
 
LVL 5

Expert Comment

by:fontaine
ID: 7152191
This is the wrong place. Your TemplateVarApplet.class should be located in the directory containing the WEB-INF subdirectory, i.e. where you place your regular files (HTML, etc.). Don't forget that the .class files that compose your applet are indeed loaded by the browser.
0
 
LVL 5

Accepted Solution

by:
fontaine earned 400 total points
ID: 7152198
You will also have to add the following codebase in your applet tag (I guess that you refer to the servlet with an URL in the style http://www.myserver.com/servlet/MyServlet):

codebase=".."
0
 

Author Comment

by:sherina
ID: 7152529
it work for a while...
but doesn't work now.
dun know what happens...
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question