cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Engelhart <>
Subject Re: Redirect POST to servlet and let Cocoon process XSL on servlets x ml output
Date Sat, 26 Aug 2000 17:47:03 GMT
<italic><fontfamily><param>Helvetica</param>To my question, I would
like to from a browser send a form with a Post</fontfamily></italic><fontfamily><param>Helvetica</param><color><param>0000,0000,0000</param>

<italic></italic></color><italic>method to a servlet which output
is in xml</italic><color><param>0000,0000,0000</param>

<italic></italic></color><italic>and let Cocoon build the a html from
the xml output. I don't want to recode</italic><color><param>0000,0000,0000</param>

<italic></italic></color><italic>the servlet and I can't chain the
servlet with cocoon.</italic><color><param>0000,0000,0000</param>

<italic></italic></color><italic>I tried to call for a xml file that
should be on the same URI as my servlet</italic><color><param>0000,0000,0000</param>

<italic></italic></color><italic>but then Cocoon tried to read the
xml page from disk.</italic><color><param>0000,0000,0000</param>

<italic></italic></color><italic>Like this: </italic><color><param>0000,0000,0000</param>

<italic></italic></color><italic><<FORM ACTION="/myservlet/a_dynamic_xml_page.xml"

<italic></italic></color><italic>The webserver is set up to forward
all .XML requests to Cocoon.</italic><color><param>0000,0000,0000</param>

<italic></italic></color><italic>How will I make this work.</italic><color><param>0000,0000,0000</param>


What you want is to use XSP for your output.  Have your servlet use a RequestDispatcher to
pass your servlet's XML object (either a DOM object or a String that you can read in) and
then pass that object on to your XSP page using something like this (i'm assuming you have
a DOM document or node but you can use a similar process to import a valid XML string I believe)

// node is an org.w3c.dom.Node

request.setAttribute("xmlnode", node);

RequestDispatcher rd = request.getRequestDispatcher("/yourxsppage.xml");

rd.forward(request, response);

then in you XSP you'd have something like:


	Node node = (Node) 	


	xspCurrentNode.appendChild(document.importNode(node, true));

View raw message