Java Code Examples for javax.servlet.jsp.tagext.SimpleTag#setJspBody()
The following examples show how to use
javax.servlet.jsp.tagext.SimpleTag#setJspBody() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JspUtilsTest.java From velocity-tools with Apache License 2.0 | 6 votes |
/** * Test method for {@link org.apache.velocity.tools.view.jsp.jspimpl.JspUtils#executeSimpleTag(org.apache.velocity.context.InternalContextAdapter, org.apache.velocity.runtime.parser.node.Node, javax.servlet.jsp.PageContext, javax.servlet.jsp.tagext.SimpleTag)}. * @throws IOException If something goes wrong. * @throws JspException If something goes wrong. */ @Test public void testExecuteSimpleTag() throws JspException, IOException { InternalContextAdapter context = createMock(InternalContextAdapter.class); Node node = createMock(Node.class); PageContext pageContext = createMock(PageContext.class); SimpleTag tag = createMock(SimpleTag.class); ASTBlock block = createMock(ASTBlock.class); tag.setJspBody(isA(VelocityJspFragment.class)); expect(node.jjtGetChild(1)).andReturn(block); tag.doTag(); replay(context, node, pageContext, block, tag); JspUtils.executeSimpleTag(context, node, pageContext, tag); verify(context, node, pageContext, block, tag); }
Example 2
Source File: JspUtils.java From velocity-tools with Apache License 2.0 | 3 votes |
/** * Executes a {@link SimpleTag}. * * @param context The directive context. * @param node The main node of the directive. * @param pageContext The page context. * @param tag The tag to execute. * @throws JspException If something goes wrong. * @throws IOException If something goes wrong. */ public static void executeSimpleTag(InternalContextAdapter context, Node node, PageContext pageContext, SimpleTag tag) throws JspException, IOException { tag.setJspBody(new VelocityJspFragment(pageContext, (ASTBlock) node .jjtGetChild(1), context)); tag.doTag(); }