Hi Pals,
I was trying to write a
servlet that picks an
applet from somewhere in the web server and fetches it to the html page it generates dynamically. Fetching an applet in a servlet should only require HTML code AFAIK. So i wrote the following applet code in StringApplet.java:
Then i wrote the servlet names AppletGenerator2.java under "mysite" package which i kept the compiled class file in "<tomcat_instl_dir>/webapps/examples/web-inf/classes" directory creating a folder named mysite.
But when access the servlet thru Tomcat4 it says ClassNotFoundException stating that StringApplet is not found.
I went to thru many trial-and-error to copy the class files, packaging them etc...But all in vain...
A
JSP page finds the applet so easily, but why the servlet is torturing me?
Here is the code for the servlet. please help me finding where am i making the mistake.
package mysite;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class AppletGenerator2 extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
res.setContentType("text/html");
PrintWriter out = res.getWriter();
// Set its title
String title = "Servlet Throwing an Applet to the Client";
out.println("<HTML>");
out.println("<HEAD>");
out.println("<TITLE>" + title + "</TITLE>");
out.println("</HEAD>"); // Start on the body
out.println("<BODY BGCOLOR= #6DA987 TEXT=blue>");
out.println("<H2>"+ title+"</H2>");
out.println("<APPLET CODE=\"StringApplet\" WIDTH=300 HEIGHT=300>");
out.println("</APPLET>");
out.println("</BODY></HTML>");
}
}
Waiting for ur help, ranchers....