Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Updating data from jsp pages into an xml file

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Suppose I have two jsp pages.The first jsp page contains a text box to enter name and age.On clicking the next button of 1st jsp page we move to the second jsp page
where we have textboxes to enter address informations like city,state,pin.Now on click of the submit button of 2nd jsp page i would like the data provided by user to get copied in a xml file.I will be already having a template xml file on the server.Now for each user based on this template a separate xml file should be created.How do i achieve the same using SAX Parser?
The template xml file(Scenario.xml), with default values, that will be on server will look something like this:-

Scenario.xml


Whenever a user enters his details,then based on the above template file and with the use of Sax Parser the data should be updated in a new xml file unique to that particular user .The name of the new xml file created can be kept unique by appending the sessionid to the xml file.The template xml file should remain as it is.

Kindly help as how should i go about it.

Regards.
 
Bartender
Posts: 2265
20
Android Java ME Eclipse IDE Java
 
neha priya
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for the reply.However i am supposed to use SAX parser ,not DOM parser.Kindly help in this regard.

Regards
 
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

neha priya wrote:However i am supposed to use SAX parser ,not DOM parser.


That doesn't make sense - SAX has no provisions for creating or altering XML, it is used for reading XML. You will need to use DOM (or one of its replacement libraries like XOM, JDOM, dom4j).
 
neha priya
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply.So can you please help me as how do i collect information from various jsp pages and put them in a unique xml file on the server.

Regards.
 
Swastik Dey
Bartender
Posts: 2265
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems that you have already passed info from page1 to page2. When page2 is submitted, the request goes once again to your servlet. Write some helper class to deal with creation of xml file, and invoke this class from the servlet.
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic