Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Updating data from jsp pages into an xml file

 
neha priya
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.
 
Swastik Dey
Rancher
Posts: 1625
5
Android Java Java ME
 
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
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • 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
Rancher
Posts: 1625
5
Android Java Java ME
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic