struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frédéric Houbie - ABSIS-GROUP <>
Subject JSP used to convert xml to html applying XSL
Date Mon, 12 Nov 2001 14:48:37 GMT

I would like to display HTML information from XML Data build on DB Access
using XSL. I found how to use Xalan to define 2 Source (XML & XSL), call
transform et put it in response:

response.setContentType("text/html; charset=UTF-8");
// Output goes in the response stream.
PrintWriter out = response.getWriter();
  TransformerFactory tFactory = TransformerFactory.newInstance();
  // Get the XML input document and the stylesheet.
  Source xmlSource = new StreamSource(new
  Source xslSource = new StreamSource(new
  // Generate the transformer.
  Transformer transformer = tFactory.newTransformer(xslSource);
  // Perform the transformation, sending the output to the response.
  transformer.transform(xmlSource, new StreamResult(out));
catch (Exception e)

return new ActionForward(null);

Now, my problem is to build the XML dynamically. I would like to create JSP
pages that will build XML from collection object put in session by Struts
Action bean. But, I don't know how to call the jsp so that xml will be
created, how to get it as a stream and to put it in Xalan transformation.

Who can help me ?


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message