Tag handler for <when> in JSTL's expression-evaluating library.
640641642643644645646647648649650651652653
{ ChooseTag chooseTag = new ChooseTag(); JspTagLifecycle chooseLifecycle = new JspTagLifecycle(pageContext, chooseTag); WhenTag whenTag = new WhenTag(); JspTagLifecycle whenLifecycle = chooseLifecycle.addNestedTag(whenTag); whenTag.setTest("false"); whenLifecycle.expectBodySkipped(); OtherwiseTag otherwiseTag = new OtherwiseTag(); JspTagLifecycle otherwiseLifecycle = chooseLifecycle.addNestedTag(otherwiseTag);
665666667668669670671672673674675676677
* @throws IOException If the tag throws an IOException */ public void testWhenTagWithoutChooseTag() throws JspException, IOException { WhenTag tag = new WhenTag(); JspTagLifecycle lifecycle = new JspTagLifecycle(pageContext, tag); tag.setTest("true"); try { lifecycle.invoke(); fail("Expected JSPTagException"); }