cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mamadou Bobo Sylla" <b...@ewarna.com>
Subject Help:Cocoon and servlet
Date Tue, 24 Jul 2001 06:54:18 GMT
Hello everyone,
I am trying to test some the code examples from Apache . When I call the xml
page countries.xml through bowser, it works fine being processd by page.xsl.
But I want countries.xml to be processed after a resquet to a servlet.
For that purpose I have writtent a servlet called Test which should now
output the xml  to be processed by a stylsheet called page.xsl.

How do I configure  Cocoon so that it becomes aware of my servlet.

The codes of Test.java:
============
public class Test extends HttpServlet {


 public void doGet( HttpServletRequest req,
                       HttpServletResponse res )
        throws ServletException, IOException
 {

  PrintWriter output = res.getWriter();
        res.setContentType( "text/xml" );

         StringBuffer xmlbuf =new StringBuffer("<?xml version=\"1.0\"
encoding = \"UTF-8\"?>");
  xmlbuf.append("<?cocoon-process type=\"xslt\"?>");
  xmlbuf.append("<?xml-stylesheet href=\"page.xsl\" type=\"text/xsl\"?>");
  xmlbuf.append("<page>");
  xmlbuf.append("<country code = \"ca\">Canada</country>");
  xmlbuf.append( "<country code = \"de\">Germany</country>");
  xmlbuf.append("<country code = \"fr\">France</country>") ;
  xmlbuf.append("<country code = \"uk\">United Kingdom</country>");
  xmlbuf.append("<country code = \"us\">United States</country>");
  xmlbuf.append("<country code = \"es\">Spain</country>");
  xmlbuf.append("</page>");

  output.println(xmlbuf.toString());

 }
==================

}
============



---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message