Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp to xml

 
Richard Elsberry
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Am having a hard time researching this one. I am currently using a jsp page with imbedded jsp's to display data from a database as html in a browser.
I would like to be able to convert the output to xml as well for additional processing but cannot figure out how to do that conversion on the fly.
My ultimate goal is to apply an xsl-fo style sheet to display the web page in a pdf document as well.
Has anybody come across this situation? I feel that once I can get the generated html page as a DOM it should be easy to use FOP for pdf display. Any thoughts or suggestions would be greatly appreciated.
Regards,
Richard
 
Djamel Djemaoun
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Richard Elsberry:
Hello,
Am having a hard time researching this one. I am currently using a jsp page with imbedded jsp's to display data from a database as html in a browser.
I would like to be able to convert the output to xml as well for additional processing but cannot figure out how to do that conversion on the fly.
My ultimate goal is to apply an xsl-fo style sheet to display the web page in a pdf document as well.
Has anybody come across this situation? I feel that once I can get the generated html page as a DOM it should be easy to use FOP for pdf display. Any thoughts or suggestions would be greatly appreciated.
Regards,
Richard

--------------------------------------------------
To convert the output of JSP page to xml:
1- You have to be sure that the JSP page content is text/xml adding:
<%@ page contentType="text/xml"%>
2- You have to notify the JSP page which the xslt file should be used to process transformation like
<?xml:stylesheet type="text/xsl"
href="file.xsl"
version="1.0"
encoding="UTF-8"?>
 
Richard Elsberry
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Djamel,
Thanks for you response. I would like to have the jsp file output to html as it already does. However, I would also like to convert a copy of the dynmaic output to another file for processing. I have been trying to figure out a way to do this but have not had much luck.
Richard
 
Edward Brode
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sounds like you are trying to get two outputs from the the same page at the same time, which I don't think can be done. You might want to have two different versions of the page with different outputs, the pages being reached by different URLs, or have essentially two different versions of the same page both on the same physical page with a parameter determining which part of the page is generating the output.
[ May 20, 2002: Message edited by: Edward Brode ]
 
Naveen Sydney
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try using the same page but change the content-type based on a url parameter.
 
river down
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any info in converting this html to a pdf...any idea, tool ? and how it works..please advise...
Say I want to convert this html to PDF upon a submit button is click...?
Thanks
 
Jeya Balaji
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might be able to get a copy of the html if you use filters.
Filters are java code which sit in between the request/response and jsp/servlet. So, by using this filter mech, u should be able to create a xml doc on the fly.
(I haven't worked with filters; just theoritical knowledge. Pls explore in that area).
Regards,
Balaji
[ January 30, 2003: Message edited by: Jeya Balaji ]
 
Ramesh Bhagasra
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi there i m trying very hard to display the contents of a pdf file whcih is stored in my oracle table as a blob field, but i m not able to stream it out through response object. i have tried everything..plzzzz help me out...
 
Steve Olson
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your are in luck ... checkout www.faceless.org ... they have a HTML to PDF servlet that converts well formatted HTML to PDF. I used this on a project and had good success with it.
Grab the PDF library.
http://big.faceless.org/products/download.jsp
--
steve
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic