• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ServletRunner

 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks William ... the <base> tag did the trick.
 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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


 
reply
    Bookmark Topic Watch Topic
  • New Topic