• Post Reply Bookmark Topic Watch Topic
  • New Topic

HTML form submission

 
Vinod Awar
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hii java gurus,

Iam dislaying a html file in JEditorPane using HTMLEditorkit.It works fine.
If i submit a html form,how will my program know about the form parameters that will be submitted?
What action listeners do i need to implement ? After searching much i have found HTMLDocument.HTMLReader.FormAction in javax.swing.text.html package.
but it is very confusing. can anybody please explain me in simple steps ?



Thanks
 
Vinod Awar
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
any thoughts on this?
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you submit a form, then a URL is involved (to which the form is submitted). That's where you need to install a servlet or some other kind of active server code that collects the parameters.

The Swing client just displays the HTML pages - it is a browser, not a web server.
 
Vinod Awar
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
does it trigger HyperLinkEvent ? how can i access the values submitted?
i want to submit the form back to my program not to any other server.

Thanks
[ May 22, 2007: Message edited by: vinod awar ]
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A link is not a form submit, and a browser is not a server.

If you want to run a web server as part of a desktop app, then you can easily use Tomcat to do that; this article explains how.
 
Vinod Awar
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ulf, i found solution.Now i can access the submitted values. on clicking the submit button it triggers FormSubmitEvent.FormSubmitEvent is a subclass of HyperlinkEvent. Using FormSubmitEvent's getData() method one can access the form parameters. here is my code




[ May 22, 2007: Message edited by: vinod awar ]
[ May 22, 2007: Message edited by: vinod awar ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!