• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applet in web application (WAR)

 
Reza Beheshti
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends

I have a web application with a lot of classes with JSPs and servlets in front.
Also I have an applet that sometimes call by a JSP.
This applet also is in my web structure.
Certainly this web application will depoly in form of WAR and not JAR file.
My problem is how can I load applet in JSP?
some points:
-Applet is in WEB-INF.
-I can not make a seperate jar for this applet because it use classes in my web application (Import com.myApplication...).


Thanks
[ December 31, 2005: Message edited by: Reza MRB ]
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Reza-

Welcome to JavaRanch.

A bit of business up front: We have a policy on screen names here, which we take serious. The name should consist of a first name and a last name, with no abbreviations. You can adjust it right here. Thanks for your attention to this matter.

As to your question, I assume it is about where to put the class files, and how to access them in the applet. Usually, they are kept in the same directory as the HTML/JSP page that contains the applet, but they don't have to be. The "archive" attribute of the applet tag can be used to specify where jar files needed by the applet are kept. You can find details here.

However, the classes and jar files can NOT be in the WEB-INF directory. That's because the browser JVM accesses the class and jar files via HTTP, and the servlet engine will not server any files inside WEB-INF via HTTP. That's a security restriction, and a good one at that. You will need to package any classes the applet needs as jar files outside of WEB-INF, and use the archive attribute to let the applet know where they are.
[ December 31, 2005: Message edited by: Ulf Dittmer ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic