01: package com.mockrunner.test.web;
02:
03: import java.io.IOException;
04: import java.io.StringWriter;
05:
06: import javax.servlet.jsp.JspException;
07: import javax.servlet.jsp.tagext.JspFragment;
08: import javax.servlet.jsp.tagext.TagSupport;
09:
10: public class TestFragmentTag extends TagSupport {
11: private JspFragment testFragment;
12:
13: public void setTestFragment(JspFragment testFragment) {
14: this .testFragment = testFragment;
15: }
16:
17: public int doStartTag() throws JspException {
18: try {
19: StringWriter writer = new StringWriter();
20: testFragment.invoke(writer);
21: pageContext.getOut().print(writer.toString());
22: } catch (IOException exc) {
23: throw new RuntimeException(exc.getMessage());
24: }
25: return EVAL_BODY_INCLUDE;
26: }
27:
28: }
|