This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes How to specify codebase for an applet running on a servlet page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to specify codebase for an applet running on a servlet page" Watch "How to specify codebase for an applet running on a servlet page" New topic
Author

How to specify codebase for an applet running on a servlet page

Henry Niu
Greenhorn

Joined: Apr 28, 2003
Posts: 2
Hi, here is the scenario I have.
I have a J2EE app. The url is: http://localhost/dnsmanager/report.screen. In the web/WEB-INF/web.xml, *.screen is mapped to TemplateServlet, and TemplateServlet is mapped to com.mycompany.j2ee.web.template.Template class which is resided in web/WEB-INF/classes folder. In the Template class, report.screen is forwarded to a physical JSP page web/docroot/report.jsp.
In the jsp page, I need display an applet ReportChart, the class of which is com.mycompany.j2ee.web.chart.ReportChart class which is resided in web/WEB-INF/classes folder. For the applet tag, I need specify the code base.
<applet code="com.mycompany.j2ee.web.chart.ReportChart.class" CODEBASE="???" width=460 height=300>
</applet>
What should I put for the codebase value? The applet specifies the codebase should be the diff dir between jsp page and applet class. I tried:
CODEBASE="" (no codebase)
CODEBASE="dnsmanager/web/WEB-INF/classes" (relative to web server root dir)
CODEBASE="../../../../../" (relative to Template file)
CODEBASE="../WEB-INF/classes" (relative to JSP file dir)
But none of them worked out -- always class not found error.
Urgent help is greatly appreciated.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12759
    
    5
To put it simply - it can't be done because web servers are forbidden to serve anything under WEB-INF. Its a security thing.
You will have to have a second copy of that class with your jsp, images, etc. where the web server is allowed to serve it. Make up a plain HTML page containing the applet to experiment with.
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to specify codebase for an applet running on a servlet page
 
Similar Threads
Calling an Applet from JSP - applet not inited?
classpath problem..
Tomcat 4 : How to deploy and run JSP and Servlets
Beginner's Servlet Not Found Error
How to specify codebase for an applet running on a servlet page