Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Question on Placing Applet class in JSP

ilarumilarum Member Posts: 28
Hi,
I have embedded an Applet in a JSP. This applet class is in a particular package. This package has other classes. The applet references these other classes within its methods. Now I have a JSP that embeds this applet within it. Where do I place this applet class. As I understand this is what I did. I had a local installation of tomcat.

The folder structure is as follows under webapps of the local tomcat installation.

test
/images (empty)
/js (empty)
/jsp (test.jsp)
/WEB-INF
/classes (all the compiled classes including the applet class)
But when runs this JSP page (small web application). Its unable to load the Applet. Why is this??? Is there a special place where I place the applet class.

With Regards
Murali




Comments

  • fzammettifzammetti Member Posts: 68
    When you embed an applet in a web page, whether it's straight HTML or a JSP, what happens is that the source code (of the HTML file or what is generated by the JSP being rendered) is returned to the browser. The browser parses it and sees the tag for the embedded applet. A new request is made to the server to retrieve the class for the applet. Therefore, the applet's class does not have to be in web-inf/classes like your app's classes do. In fact, I'm not sure it CAN be there actually. But either way, the point is that the tag in your HTML or JSP that embeds the applet needs to point to the class on your server.

    I think what's confusing you is that if you put classes in web-inf/classes, you can then import them into a JSP, and you expect that the same would be true of an applet. It's not, because the imports in your JSP are interpreted on the server, whereas the applet embed tag is interpreted on the client, which doesn't have knowledge of the server's classpath (that is a rather convoluted simplification, but I think essentially correct).

    : Hi,
    : I have embedded an Applet in a JSP. This applet class is in a particular package. This package has other classes. The applet references these other classes within its methods. Now I have a JSP that embeds this applet within it. Where do I place this applet class. As I understand this is what I did. I had a local installation of tomcat.
    :
    : The folder structure is as follows under webapps of the local tomcat installation.
    :
    : test
    : /images (empty)
    : /js (empty)
    : /jsp (test.jsp)
    : /WEB-INF
    : /classes (all the compiled classes including the applet class)
    : But when runs this JSP page (small web application). Its unable to load the Applet. Why is this??? Is there a special place where I place the applet class.
    :
    : With Regards
    : Murali
    :
    :
    :
    :
    :

Sign In or Register to comment.