Solved

Include Applet tag in Java Servlet

Posted on 2002-07-14
3
327 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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Suggested Solutions

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

751 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