Unable to convert a JDBC Result Set into Xml File
Any ideas on how to convert a ResultSet to XML in Java? I have a problem to export my SQL query is resulty into an XML file. I need some java code to store my resultset in a xml file. And next the buyer or the user will select the books depends on the price ,so I have to store all the books in a xml and search according to the price.
Re: Unable to convert a JDBC Result Set into Xml File
It looks like you are putting freely typed-in comments from end-users into an xml document. Simply convert your data into xml string. Write the string to the response stream, and set the content-type header as text/xml, and content-length header as length of string. The problem with this is that the user may enter characters in his text that have special meaning to xml and will have to be escaped correctly.
Re: Unable to convert a JDBC Result Set into Xml File
XML has become the common format for passing data between components residing on different platforms. As far as searching goes I'm not quite sure what your actual requirements are here--how the data is stored shouldn't really matter to the searching, unless they're searching XML by just looking at the file. With the move to XML-based services, developers often find themselves converting various data structures to and from XML. Arguably, the most prevalent form of persisting data is in relational databases.
Re: Unable to convert a JDBC Result Set into Xml File
The Hibernate Framework includes functionality for producing XML-based data derived from relational data. There is a simple toXML() method which handles this. The JSP page is for displaying data ONLY and submitting back to a servlet. Put all your business logic in the servlet. Putting business logic in JSP is considered bad coding and will cause you many hours of headache trying to debug it.