Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to call Servlet from Applet?

 
Aman Verma
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Im new to Applets.

Would anyone please tell me how to invoke servlet from a applet? I just want to execute a servlet when user will click on a button on applet.

Thanks
-Aman
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could use getAppletContext().showDocument() if the servlet's output is s Web page you want to display. Otherwise, just use the java.net.URLConnection class.
 
Sean McGarvey
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working on a problem similar to this. When I use getAppletContext().showDocument() to invoke my servlet to produce output to be displaying in a web browser, everything works great.

The problem is that the servlet does not receive the session info from the applet. In fact, request.getSession(false) returns null.

Any suggestions? Is there an Apache setting that I need to configure?

Thanks,
Sean
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic