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

JSP with XML

James Sivakumar

Joined: Nov 16, 2000
Posts: 21
Hi All,
I'm quite new to JSP with XMl tech..
Can anybody help me out in solving this problem.

1a)How to create a JSP file which will generate an XML file containing all the records from the table(Use JDBC code within the JSP page instead of JavaBeans).
And also ....
b)Then the JSP file will use an XSL file that you have created to format the XML data into HTML code and send it back to the browser.

William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13036
I don't think it is a good idea to try to do so much processing inside a JSP page - a JavaBean that creates a String containing the XML would work since you can feed the String to an XSL process. Why don't you want to do it that way?
author of:
dileep keely
Ranch Hand

Joined: Jun 28, 2010
Posts: 108
set the contentType as <%@ page contentType="text/xml" %> which will generate the output as xml.
A sample example below.
<portal address="<%= request.getLocalAddr() %>" port="<%= request.getLocalPort() %>">
<hostname><%= request.getLocalName() %></hostname>
<address><%= request.getLocalAddr() %></address>
<port><%= request.getLocalPort() %></port>
<sessionid><%= request.getSession().getId() %></sessionid>

I agree. Here's the link:
subject: JSP with XML
It's not a secret anymore!