Hi All
When i run the html file(has reference to an applet) from within the browser as (c:\jakarta-tomcat3.2.1\.....\jsp\practice\hello.html)
it runs fine,I have all files within the folder (practice).
But when i try to lunch that file(hello.html) from within the servlet i can't lunch the applet.
i got error that says: " Jspapplet class not found ".
Here is all my files:
hello.html
//======================
<html>
<applet type="applet" code="JspApplet.class" codebase="" width="200" height="200" >
</applet>
</html>
//=====================
testServlet.java
//=====================
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class testServlet extends HttpServlet
{
public void service (HttpServletRequest request,
HttpServletResponse response)
throws ServletException,IOException
{
//PrintWriter out=response.getWriter();
//response.setContentType("text/html"
ServletContext xt =this.getServletContext();
RequestDispatcher dispatcher = xt.getRequestDispatcher("/jsp/practice/hello.html"
dispatcher.forward( request,response);
}
}
//=============================
JspApplet.java
//============================
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import java.net.*;
public class JspApplet extends Applet
{
String s;
public void setString(String s)
{
this.s=s;
}
public void init()
{
Button b1 = new Button("Click"
add(b1);
b1.addActionListener(new moh(this));
this.setBackground(Color.cyan);
//this.getParameter("matt"
}
public String see()
{
return "mattseif";
}
}
class moh implements ActionListener
{
JspApplet j;
public moh(JspApplet j)
{
this.j=j;
}
public void actionPerformed(ActionEvent e)
{
try
{
j.getAppletContext().showDocument(new URL(j.getDocumentBase(), " }
catch (MalformedURLException ee)
{
}
}
}
//============================
When i run the html file(has reference to an applet) from within the browser as (c:\jakarta-tomcat3.2.1\.....\jsp\practice\hello.html)
it runs fine,I have all files within the folder (practice).
But when i try to lunch that file(hello.html) from within the servlet i can't lunch the applet.
i got error that says: " Jspapplet class not found ".
Here is all my files:
hello.html
//======================
<html>
<applet type="applet" code="JspApplet.class" codebase="" width="200" height="200" >
</applet>
</html>
//=====================
testServlet.java
//=====================
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class testServlet extends HttpServlet
{
public void service (HttpServletRequest request,
HttpServletResponse response)
throws ServletException,IOException
{
//PrintWriter out=response.getWriter();
//response.setContentType("text/html"
ServletContext xt =this.getServletContext();
RequestDispatcher dispatcher = xt.getRequestDispatcher("/jsp/practice/hello.html"
dispatcher.forward( request,response);
}
}
//=============================
JspApplet.java
//============================
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import java.net.*;
public class JspApplet extends Applet
{
String s;
public void setString(String s)
{
this.s=s;
}
public void init()
{
Button b1 = new Button("Click"
add(b1);
b1.addActionListener(new moh(this));
this.setBackground(Color.cyan);
//this.getParameter("matt"
}
public String see()
{
return "mattseif";
}
}
class moh implements ActionListener
{
JspApplet j;
public moh(JspApplet j)
{
this.j=j;
}
public void actionPerformed(ActionEvent e)
{
try
{
j.getAppletContext().showDocument(new URL(j.getDocumentBase(), " }
catch (MalformedURLException ee)
{
}
}
}
//============================