Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

How to read a html form through a java program and write the string recieved into xml

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.. I need to know how can i read the values from a HTML page using a java program. I need my java program to hold these values read from the page and pass it on to an XML file which in read these string of values and display them after breaking them.
For Eg:
i have an html form which takes input as:

Name: July
Age:34
Gender: F

I want my java program to read this html form and form a string which is similar to : July34F and pass this string to an XML file which in turn will display the content as and store the same:

Name: July
Age:34
Gender: F

Any suggestions...?

 
Ranch Hand
Posts: 47
Eclipse IDE Tomcat Server Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you may need to download JTidy.jar
Hope, this may help you...
This program will straight away convert your html file to Xml, eliminating the need of creating a intermediate string
 
Mehek Sudhakaran
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply... but I am unable to download the JTidy.jar...Only snapshots are available in sourceforge.net..
 
rastogi payam
Ranch Hand
Posts: 47
Eclipse IDE Tomcat Server Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Follow this link
 
Mehek Sudhakaran
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thankyou.. but this site is blocked at my workplace... Is there any other site i can get the download from?
 
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As per my understanding, the mentioned library will simply convert html to xml. But the probably requirement is something else. A html page opens, user clicks on submit and the other processing start. Correct me if I am wrong.
 
Mehek Sudhakaran
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Swastik..
I need to form a string out of the inputs that i recieve from the html page n then split them again into an xml page..
I am not sure baout the above code since i havn't tried the same yet.
 
Swastik Dey
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So the very first step is to receive the submitted data, and as much as I understand for this you need some server side scripting like servlet/jsp.
 
Saloon Keeper
Posts: 7231
169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd use a library like HtmlUnit or jWebUnit for this.
 
reply
    Bookmark Topic Watch Topic
  • New Topic