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="http://www.w3.org/1999/XSL/Transform" version="1.0"> 
 
<xsl:template match="/"> 
<html> 
<body> 
<table border="2" bgcolor="yellow"> 
<tr> 
<th>Name</th> 
<th>Place</th> 
<th>Number</th> 
<th>Mark</th> 
</tr> 
 
<xsl:for-each select="students/student"> 
<tr> 
<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> 
</tr> 
</xsl:for-each>
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