Why not to use RequestDispatcher's include? Opening a new URL connection for every include on a page is performance overhead.
Do you have separate web application contexts for Struts and Cocoon? If yes, then URL connection is the only way, but if you place Cocoon in the same webapp context and map to path like "*.xml" or "*.xsp" then you'll be able to use include(). -- Konstantin Piroumian [EMAIL PROTECTED] > -----Original Message----- > From: Moritz Petersen [mailto:[EMAIL PROTECTED]] > Sent: Thursday, March 21, 2002 12:30 PM > To: Cocoon-Users; Struts-User > Subject: including cocoon in jsp using struts > > > hello! > > ------------------------------------------------------------ > sorry for cross-posting this to cocoon-uses and struts-user! > ------------------------------------------------------------ > > i have the problem, that i need to dynamically include cocoon > results into a > jsp page. because we use struts for our webapplication, i'd > like to find a > way to combine both. > > i'd like to have something like > > <struts:include> > <bean:write name="url"> > </struts:include> > > where struts:include is a tag, that evaluates its body to a > valid url. the > content of the url shall be included, where the > struts:include tag was. > > i have written a tag, that works, but only with exsiting > files, not with > cocoon pipelines (because it calls file:/ urls): > > public class IncludeTag extends BodyTagSupport > { > public int doAfterBody() > throws > JspException > { > String key = getBodyContent().getString().trim(); > > try > { > // call cocoon servlet with key > URL cocoon = new URL(key); > BufferedInputStream in = new > BufferedInputStream(cocoon.openStream()); > > // read the output in a buffer. > byte[] buf = new byte[in.available()]; > in.read(buf); > > // write the buffer to the page. > getPreviousOut().print(new String(buf)); > in.close(); > } > catch (Exception e) > { > e.printStackTrace(); > } > > return SKIP_BODY; > } > } > > > any help will be appreciated! > > -moritz. > > > --------------------------------------------------------------------- > Please check that your question has not already been answered in the > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html> > > To unsubscribe, e-mail: <[EMAIL PROTECTED]> > For additional commands, e-mail: <[EMAIL PROTECTED]> > --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faqs.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>