im sorry eike.. its the same..
maybe you dont have any value for your parameters..
>From: Eike Hirsch <[EMAIL PROTECTED]>
>Reply-To: "A mailing list for discussion about Sun Microsystem's Java
> Servlet API Technology." <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: Need help!!
>Date: Wed, 29 Mar 2000 12:29:26 +0200
>
>hi.
>You have to set the Content-Typ before you request a writer!!!
>like:
> res.setContentType("text/html");
> PrintWriter out = res.getWriter();
>that's all
>eike
>
>
>
>Ryan Richards schrieb:
>
> > I am writing a servlet to dynamicallt create an HTML file that holds an
>applet. I keep running into weird class loader, bad magic number etc.
>errors.
> >
> > Here is the code: by itself it works fine if I print it out as
>text/ascii but currently I have the content type set to text/html:
> > ----------------------------------------------------------------
> > import java.sql.*;
> > import java.io.*;
> > import javax.servlet.*;
> > import javax.servlet.http.*;
> > import java.util.StringTokenizer;
> >
> > public class pageGenerator extends HttpServlet
> > implements SingleThreadModel {
> > Connection conn = null;
> >
> > public void init( ServletConfig config ) throws ServletException {
> > super.init(config);
> > }
> >
> > public void doGet( HttpServletRequest req,
> > HttpServletResponse res )
> > throws ServletException, IOException {
> >
> > // Setup the stream
> > PrintWriter out = res.getWriter();
> > res.setContentType("text/html");
> >
> > // Get parameters
> > String title_string = new String(req.getParameter("TITLE"));
> > String setup_string = new String(req.getParameter("SETUP"));
> > String multiple_string = new
>String(req.getParameter("MULTIPLE"));
> > String repname_string = new String(req.getParameter("REPNAME"));
> >
> > out.println("<HTML>");
> > out.println( "<TITLE>"+title_string+"</TITLE>");
> > out.println( "<BODY>");
> > out.println( "<CENTER>");
> > out.println( "<TABLE BORDER CELLSPACING=5 CELLPADDING=5
>COLS=1 WIDTH=\"45%\" BGCOLOR=\"#FFFFFF\">");
> > out.println( "<TR ALIGN=CENTER BGCOLOR=\"#000099\">");
> > out.println( "<TD>");
> > out.println( "<B><FONT FACE=\"Lucida Sans\">");
> > out.println( "<FONT COLOR=\"#FFFF99\">");
> > out.println( title_string);
> > out.println( "</FONT></FONT></B>");
> > out.println( "</TD>");
> > out.println( "</TR>");
> > out.println( "<TR ALIGN=CENTER VALIGN=CENTER>");
> > out.println( "<TD>");
> > out.println( "<APPLET CODE=\"reportUI\"");
> > out.println( "codebase=\".\"");
> > out.println( "width=430");
> > out.println( "height=410>");
> > out.println( "<PARAM NAME=\"SETUP\"
>VALUE=\""+setup_string+"\">");
> > out.println( "<PARAM NAME=\"MULTIPLE\"
>VALUE=\""+multiple_string+"\">");
> > out.println( "<PARAM NAME=\"REPNAME\"
>VALUE=\""+repname_string+"\">");
> > out.println( "</APPLET>");
> > out.println( "</TD>");
> > out.println( "</TR>");
> > out.println( "</TABLE>");
> > out.println( "</CENTER>");
> > out.println( "</BODY>");
> > out.println("</HTML>");
> >
> > out.close();
> > }
> > }
> >
> > Here is the error I get:
> > -----------------------------------------------------
> >
> > Netscape Communications Corporation -- Java 1.1.5
> >
> > Type '?' for options.
> >
> > Symantec Java! ByteCode Compiler Version 210.065
> > Copyright (C) 1996-97 Symantec Corporation
> > # Applet exception: error: java.lang.ClassFormatError: Bad magic number
> >
> > java.lang.ClassFormatError: Bad magic number
> >
> > at java.lang.ClassLoader.defineClass(Compiled Code)
> >
> > at netscape.applet.AppletClassLoader.loadClass(Compiled Code)
> >
> > at netscape.applet.AppletClassLoader.findClass(Compiled Code)
> >
> > at netscape.applet.AppletClassLoader.loadClass1(Compiled Code)
> >
> > * at netscape.applet.AppletClassLoader.loadClass(Compiled Code)
> >
> > at netscape.applet.AppletClassLoader.loadClass(Compiled Code)
> >
> > at
>netscape.applet.DerivedAppletFrame$LoadAppletEvent.dispatch(Compiled Code)
> >
> > at java.awt.EventDispatchThread$EventPump.dispatchEvents(Compiled
>Code)
> >
> > at java.awt.EventDispatchThread.run(Compiled Code)
> >
> > at
>netscape.applet.DerivedAppletFrame$AppletEventDispatchThread.run(Compiled
>Code)
> >
> > Ryan Richards
> > Technical Consultant
> > Database Consultants, Inc.
> > Oklahoma City, OK
> > -----------------------------------------------
> > FREE! The World's Best Email Address @email.com
> > Reserve your name now at http://www.email.com
> >
> >
>___________________________________________________________________________
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
>body
> > of the message "signoff SERVLET-INTEREST".
> >
> > Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > Resources: http://java.sun.com/products/servlet/external-resources.html
> > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html