You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Moritz Petersen <pe...@pnpconsult.com> on 2002/03/21 10:08:04 UTC
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.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>