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

JSP with XML

 
James Sivakumar
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Shiva.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
Bill
------------------
author of:
 
dileep keely
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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() %>">
<serverinfo>
<hostname><%= request.getLocalName() %></hostname>
<address><%= request.getLocalAddr() %></address>
<port><%= request.getLocalPort() %></port>
<sessionid><%= request.getSession().getId() %></sessionid>
</serverinfo>
</portal>

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic