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
Marshal
Joined: Mar 22, 2005
Posts: 35224
7
posted
0
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.
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
Marshal
Joined: Mar 22, 2005
Posts: 35224
7
posted
0
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
Joined: Aug 11, 2008
Posts: 63
posted
0
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
Marshal
Joined: Mar 22, 2005
Posts: 35224
7
posted
0
No. You could use the applet's showDocument method to replace the page with some other URL (which can contain parameters if need be).