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]>

Reply via email to