troubleshooting Question

Problem with using PrintWriter inside a JSP

Avatar of KenTan85
KenTan85 asked on
Web Languages and StandardsJSP
3 Comments1 Solution480 ViewsLast Modified:
I have a JSP where i try to print a XML data.

After the Jsp executes, I see only the data in the screen. I should see a table along with the data(tables are defined in the XSL file).
Same code works when we use PrintWriter from with in the servlet.It didnt work inside a JSP.
Please suggest me what i am missing.

PS: I cannot create xml file and use transformation as i need to have pagination on the html page...
JSP Code:
PrintWriter out= response.getWriter();
out.write("xml version='1.0'?><?xml-stylesheet type='text/xsl' href='book.xsl'?><students> <student><name>Thomas</name><place>Delhi</place> <number>1111</number> <mark>78</mark></student>></students>"")
XSL Code:
XSL file is below : <?xml version="1.0"?> 
<xsl:stylesheet xmlns:xsl="" version="1.0"> 
<xsl:template match="/"> 
<table border="2" bgcolor="yellow"> 
<xsl:for-each select="students/student"> 
<td><xsl:value-of select="name"/> </td> 
<td><xsl:value-of select="place"/> </td>
<td><xsl:value-of select="number"/> </td> 
<td><xsl:value-of select="mark"/> </td> 
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros