Keep in mind the applet is client side code and has to be available to
the client. To that end have you thought about a companion servlet that
accepts requests and returns applets and other resources? Then jsp code
would just reference the mapped servlet in what it offers up to the client.
Let's say the servlet serving up your applet and resources is mapped to
/appletRes in your webapp. The jsp could then access
${request.contextPath}/appletRes/resources/applet.class or what ever.
The client browser would then request the applet/resources separately
and the companion servlet would find resources/applet.class in your jar
file.
The default servlet in tomcat could provide the base for your companion
servlet -- just download the tomcat source and copy that code for your use.
--David
Kristian Rink wrote:
Folks,
slightly OT: can someone provide me with a few good pointers and/or
hints how to correctly integrate a Java applet into a JEE based web
application?
More specifically, my problem is something like that: I do
have a .jsp containing code to show an applet. Both applet .class and
some other resources (.properties files, images, ...) do live inside
a .jar file in the same folder as the .jsp. Unfortunately(?), the .jsp
is never called directly but rather forward()ed to from within a
servlet mapped to some specific URL. So, the situation is that
- while calling the .jsp directly (using
http://<host>/<context>/<real-path-to>/file.jsp ), the applet loads and
runs the way it's supposed to, but
- while having the resource called the way it's supposed to (using
http://<host>/<context>/<mapping-for-servlet-forwarding-to-jsp>/ )
the plugin doesn't load but provide me with ClassNotFoundException,
obviously not capable to find the applet class. Tried playing around
with the applets "archive" / "codebase" parameters made things just
slightly better: By now the browser does lock up, the applet class
seems to get loaded, but obviously fails to load some resources, and I
see strange access attempts in my tomcat log, trying to fetch resources
like
/<context>/<servlet-mapping>/<classpath>/lang/de_DE.properties
(the file originally lives inside the applet.jar in <classpath>.lang).
Is there any sane way of keeping applets inside a JEE web application,
regardless on whether they're invoked directly from a .jsp or from a
resource forwarded to from within some servlet? Or am I just too stupid?
Sorry again for the OT, feel free to contact me off-list in case you
feel like providing me with some hints / pointers.
Thanks loads and best regards,
Kristian
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]