Solved

Include Applet tag in Java Servlet

Posted on 2002-07-14
3
330 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 100 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Suggested Courses

635 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