• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ServletRunner

 
Savio Mascarenhas
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If an applet is invoked from within a servlet ,what should the code attribute of the applet tag specify cause ... i get an error "<appletname> APPLET NOT FOUND" .How should i specify the syntax if the applet is placed in the servers root directory ie.JSDK2.0.
Thanx.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13073
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because as far as a browser is concerned, a page created by a servlet comes from some weird URL, you have to make special provision for things like images, sound files and applet class files. You can:
1. provide an absolute URL for every resource
2. use the <base> tag in the <head> area of the page to define a base url where the browser can look for images, etc. that have relative addresses.
<base href="http://myserver/myapplication" />
Bill
------------------
author of:
 
Harish Ramamurthy
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi William,
I am facing the same path problems. I want to pop out an applet from a servlet.Presently I am using JSDK2.1. I have put the jsdk directory in d:\ i.e. d:\jsdk2.1. Now I have placed my applet class in the directory d:\jsdk2.1\examples\web-inf\servlets. I have also placed a simple servlet in the same location. In the servlet's doGet() method I just return the following HTML code in response.
<html>
<head>
<base href="http://localhost/examples/servlet/">
</head>
<applet code="busGUI" width=200 height=200>
</applet>
</html>
I access my servlet using the URL http://localhost/examples/servlet/MyServer
It gives out an error class busGUI not found. Now When I type the URL http://localhost/examples/servlet/busGUI, It gives an error class cast exception ( which should be there as busGUI is an applet and not a servlet).
I don't understand at all now. Please help me.
Thanks
Harish
 
Savio Mascarenhas
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks William ... the <base> tag did the trick.
 
Subbu Aswathanarayan
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Harish,
i think there is a small error in ur HTML code.
instead of :
<base href="http://localhost/examples/servlet/">
try this
<base href="http://localhost/examples/servlet" />
do let us know if that works.

Subbu
Originally posted by Harish Ramamurthy:
Hi William,
I am facing the same path problems. I want to pop out an applet from a servlet.Presently I am using JSDK2.1. I have put the jsdk directory in d:\ i.e. d:\jsdk2.1. Now I have placed my applet class in the directory d:\jsdk2.1\examples\web-inf\servlets. I have also placed a simple servlet in the same location. In the servlet's doGet() method I just return the following HTML code in response.
<html>
<head>
<base href="http://localhost/examples/servlet/">
</head>
<applet code="busGUI" width=200 height=200>
</applet>
</html>
I access my servlet using the URL http://localhost/examples/servlet/MyServer
It gives out an error class busGUI not found. Now When I type the URL http://localhost/examples/servlet/busGUI, It gives an error class cast exception ( which should be there as busGUI is an applet and not a servlet).
I don't understand at all now. Please help me.
Thanks
Harish

 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic