1 Reply Latest reply on Dec 27, 2004 5:49 PM by 843807

    Applet vs JSP and Servlet

    843807
      Hello.

      I have the next problem:

      1. I have a Servlet call one JSP

      public void doTaks(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {
      HttpSession session = req.getSession(true); //Manejo de session
      requestDispatch(getServletConfig().getServletContext(), req, resp, "jsp/test.jsp"); //$NON-NLS-1$
      }

      2. The JSP call a applet:

      <APPLET code="co.com.logic.TestApplet"
      archive="Test.jar" width="50" height="50"></APPLET>

      The jar have the class: TestApplet.

      3. When the JSP begin load, it shows the next error:

      java.lang.ClassFormatError: co/com/logic/TestApplet(Bad magic number)
      at java.lang.ClassLoader.defineClass0(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
      at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:148)
      at sun.plugin.security.PluginClassLoader.findClass(PluginClassLoader.java:168)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
      at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:114)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
      at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:501)
      at sun.applet.AppletPanel.createApplet(AppletPanel.java:567)
      at sun.plugin.AppletViewer.createApplet(AppletViewer.java:1778)
      at sun.applet.AppletPanel.runLoader(AppletPanel.java:496)
      at sun.applet.AppletPanel.run(AppletPanel.java:293)
      at java.lang.Thread.run(Thread.java:536)

      4. But execute the JSP: test.jsp, it not shows error.

      thanks