On Tue, 24 Oct 2000, Heakyung Park wrote:

> I stored the applet in the same directory as the servlet is located.

That is probably not the right place to put it.  Remember, as far as
the web server is concerned, the servlets directory is a virtual
directory that the servlet container knows about.  That's not going to
help when it comes to finding the applet code -- i.e. it's not the
servlet container that needs to find the applet code, but rather the
web server itself.

> My problem is not finding the applet to be loaded, it is that "the
> applet cannot be loaded." I tried the code base approach, if the

Well, if it can't find it, it certainly can't load it.

> browser doesn't find the applet, the message says "the applet cannot
> be found." I hope I didn't misunderstand you. Thanks.

Is this an actual error message?

I recently set up something like this, and I was getting a similar
"applet could not be loaded" error from the browser.  I moved the
applet code and added an appropriate CODEBASE attribute, and it worked
fine after that.

Also remember that the browser needs to be able to find any other
auxiliary classes the applet needs.


> On Tue, 24 Oct 2000, Milt Epstein wrote:
>
> > On Tue, 24 Oct 2000, Heakyung Park wrote:
> >
> > > So you mean the reason I am having the problem is due to my code? No other
> > > possible reason?
> > >
> > > The following is the servlet code to display java applet;
> > > import java.io.*;
> > > import javax.servlet.*;
> > > public class gan extends GenericServlet {
> > >         public void service (ServletRequest request, ServletResponse
> > > response) throws ServletException, IOException {
> > > response.setContentType("text/html");
> > > PrintWriter pw = response.getWriter();
> > > pw.println("<html><head><title>Gentt Chart</title></head><body>");
> > > pw.println("<h1>Project Schedule in Gantt Chart</h1>");
> > > pw.println("<applet code=\"gantt\" width=500 height=500></applet>");
> > > pw.println("</body></html>");
> > > pw.close();
> > > }
> > > }
> > [ ... ]
> >
> > I suspect the problem is that the browser cannot find the applet code
> > to (down)load.  The way you have it above, the applet code is expected
> > to be in the same "directory" as the html page, but that html was
> > generated by a servlet, so it's in the servlet virtual directory.  I
> > think you need to specify a directory via the CODEBASE attribute on
> > the APPLET tag that will tell the browser where to find the applet
> > code.  (The exact value of which depends on where the applet code is.)
> >
>

Milt Epstein
Research Programmer
Software/Systems Development Group
Computing and Communications Services Office (CCSO)
University of Illinois at Urbana-Champaign (UIUC)
[EMAIL PROTECTED]

___________________________________________________________________________
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

Reply via email to