wood burning stoves 2.0*
The moose likes Servlets and the fly likes submit html for via applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "submit html for via applet" Watch "submit html for via applet" New topic
Author

submit html for via applet

Stu Johns
Ranch Hand

Joined: Aug 11, 2008
Posts: 63
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: 39548
    
  27
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.


Ping & DNS - updated with new look and Ping home screen widget
Stu Johns
Ranch Hand

Joined: Aug 11, 2008
Posts: 63
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: 39548
    
  27
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
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: 39548
    
  27
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

Joined: Dec 18, 2008
Posts: 164

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


Java Best Practices
Linux Best Practices
Amortization Calculator

Stu Johns
Ranch Hand

Joined: Aug 11, 2008
Posts: 63
thanks you guys, youve given me alot of help there, much appreciated
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: submit html for via applet
 
Similar Threads
Dynamic Graph
Applet handling a HTM Form
dynamic form processing
Urgent Problem: Please help -> showing web page
Servlet to Applet