• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

submit html for via applet

 
Stu Johns
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Is it possible to submit an html form to a servlet via an applet?
I know i can get values from the applet using javascript but i really want to do it purely from an applet.
my situation is:
I want to write an applet that displays an interactive graph. When the user clicks on various parts of the graph i'd like to be able to send the info via a html form to a servlet to process it, back from the server would come some html to display to user.
all the servlets are written i just need to be able to plug the applet into the existing architecture.

any ideas if/ how this would be possible?

thanks

Stu
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the graph that the user interacts with is part of the applet, and you want to submit via the applet, then why involve HTML at all? The applet could provide a UI for whatever options you want the user to have. That would be much cleaner than any HTML/applet interaction.
 
Stu Johns
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
because the code to generate the response (a html page) from the user interaction is a servlet that is currently called via html form submit. I was just wanting to plug the applet into the existing structure if possible. Or call the servlet directly passing the values in some way?
I think i just found the answer I was looking for.:
webpage
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you don't need the HTML form, you need to reuse the servlet. An applet can access the servlet via HTTP GET or POST. Of course if the servlet returns HTML, then the applet won't be able to make sense of that. But the applet could pass in an additional parameter that indicates to the servlet that it shouldn't return HTML, but whatever is convenient for the applet to digest.
 
Stu Johns
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
once the applet has called the servlet i want the servlet to return a complete html page to the users browser. Can I do that?
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. You could use the applet's showDocument method to replace the page with some other URL (which can contain parameters if need be).
 
Vinoth Thirunavukarasu
Ranch Hand
Posts: 164
Android Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I did the example program for communication between a applet and servlet. See the example http://www.hiox.org/bypass/index.php?id=977
 
Stu Johns
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks you guys, youve given me alot of help there, much appreciated
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic