Hai,
Consider the following coding. It's concerned with calling an applet from servlet.
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Helloser extends HttpServlet
{
public void doGet(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException
{
PrintWriter out=res.getWriter();
out.println("<html><head><h1>Hello World</h1>");
out.println("<base href=\"c:\\servlet\"></head>");
out.println("<applet code=hello.class height=400 width=400>");
out.println("</applet></html>");
out.close();
}
}
Here hello.class is the compiled code of the hello.java applet file, which is available in the directory c:\servlet. I've used servletrunner, jsdk application for this program. I've specified the address to see the page in browser like,
http://localhost:8080/servlet/Helloser it calls the Helloser servlet and while loading hello applet class, it says that hello class not found. Here Helloser.java is the servlet file name available in the c:\servlet directory.
What is wrong in the above code? Please explain.
With regards
Chandru