Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

creating XML from Beans

 
Yell Srik
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i want to know if the following is possible using EJB and XML.
using HTML/javascript, a form has been created. now the user makes selections using the form. i want to create a XML file that encapsulates the user selections ie this XML file should contain the selections made by the user. this XML file should also automatically change whenever the user makes new selections on the HTML form.
someone suggested me that Beans are the best option to use. can u guide me on how to proceed using Beans.
thanks in advance.
 
Ali Gohar
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whenever user select something and submit the request. You just call the bean to write that selection in XML File. You can use DOM or JDOM to create the XML File using java beans.
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you think that using XML is the best option? Where do you plan on storing these files? Have you thought of just entering this information in a database instead (which is the more common and easier solution).
Java is an Object-oriented language. Objects are almost ALWAYS easier to use and faster than XML when you're not using XML as a program-to-program communication mechanism. Just create objects to hold the selections -- if they need to persist over a long time, then store the objects in a database (you should look into a commercial or free object-to-relational mapping tool like Hibernate -- the folks in the Object-to-Relational forum always have opinions on things like this).
Kyle
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic