• 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

Servlet can Call an Applet

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My Question is when servlet call an applet like this
out.println("<applet code=xyz.class codebase=http://..... width=200 height=400></applet>")
is this works?? if yes kindly tell me where the xyz.class should placed or how should i call an applet class in servlet??
i have placed xyz.class file in the same directory as my servlet class file.
ie. http://url/servlet directory.
what path should i give it to call my applet in servlet.should it be
out.println("<applet code=xyz.class codebase=http://url/servlet/ width=200 height=400></applet>")
or if i place my applet xyz.class in html directory.then how should i give the path. since
both the ways are not working.
it is should applet load: class xyz not found
thanks in advance
 
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
1. Servlets don't call applets, servlets write HTML pages that have embedded applet tags.
2. Applet classes are loaded by applet rules NOT servlet rules. They are loaded by requests from the browser to the web server so the class files have to be where the web server can serve them. Servers are forbidden to serve files from WEB-INF.
3. A page written by a servlet should look just like a static HTML page when it gets to the browser.
You should start by creating a static page containing your applet and get that running. Then you can work on making your servlet write a page containing the applet tag.
Bill
 
Ranch Hand
Posts: 686
Mac
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In short you just have to use Http Tunneling.
-jignesh
 
Ranch Hand
Posts: 250
Python Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by j_kokil:
In short you just have to use Http Tunneling.


Hi Jignesh,
I am afraid we are not talking about HTTP tunneling here, are we Bill? This query was not about Applet-Servlet communication, the servlets simply creates an APPLET tag. HTTP tunneling is simply a way of bypassing firewall restrictions and enabling Java applets to communicate with the servers.
 
William Brogden
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
As I understand the use of the word, we are not talking about HTTP tunneling when a browser loads an applet by requesting class files from the server. Now, if the applet exchanges data with the server using a HttpURLConnection, I would call it tunneling.
Bill
 
reply
    Bookmark Topic Watch Topic
  • New Topic