File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes creating XML from Beans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "creating XML from Beans" Watch "creating XML from Beans" New topic

creating XML from Beans

Yell Srik
Ranch Hand

Joined: Mar 10, 2004
Posts: 61
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

Joined: Mar 18, 2004
Posts: 572
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
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
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 Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at for other WebSphere information.
I agree. Here's the link:
subject: creating XML from Beans
jQuery in Action, 3rd edition