G
G.C.
Hello,
I want to write a java servlet to produce an html file. Instead of
writing an html file directly, I want to write a xml file describing
the html file, then process it using an xsl file.
Here is the main part:
public void doPost(HttpServletRequest request, httpServletResponse
resp)
throws IOException, ServletException
{
PrintWriter pout = resp.getWriter();
pout.println("<?xml version=\"1.0\"?>");
pout.println("<?xml-stylesheet type=\"text/xsl\"
href=\"test.xsl\"?>");
pout.println("<FitnessCenter>");
pout.println("<Member>");
pout.println("<Name>Jeff</Name>");
pout.println("</Member>");
pout.println("</FitnessCenter>");
}
As far as I understand, the xml is written directly to a web browser,
and automatically processed by test.xsl.
The problem is I get a "The XML page cannot be displayed" error
message. I checked and it looks like the browser cannot find the xsl
file.
I used the command "context.getRealPath("test.xsl")" to see where it
excepts to find the xsl file, and put the file there, but still I get
the same message. Do you have any idea why? where should I put the xsl
file?!!!
Thanks,
GC
I want to write a java servlet to produce an html file. Instead of
writing an html file directly, I want to write a xml file describing
the html file, then process it using an xsl file.
Here is the main part:
public void doPost(HttpServletRequest request, httpServletResponse
resp)
throws IOException, ServletException
{
PrintWriter pout = resp.getWriter();
pout.println("<?xml version=\"1.0\"?>");
pout.println("<?xml-stylesheet type=\"text/xsl\"
href=\"test.xsl\"?>");
pout.println("<FitnessCenter>");
pout.println("<Member>");
pout.println("<Name>Jeff</Name>");
pout.println("</Member>");
pout.println("</FitnessCenter>");
}
As far as I understand, the xml is written directly to a web browser,
and automatically processed by test.xsl.
The problem is I get a "The XML page cannot be displayed" error
message. I checked and it looks like the browser cannot find the xsl
file.
I used the command "context.getRealPath("test.xsl")" to see where it
excepts to find the xsl file, and put the file there, but still I get
the same message. Do you have any idea why? where should I put the xsl
file?!!!
Thanks,
GC