List of usage examples for javax.servlet.jsp JspException printStackTrace
public void printStackTrace()
From source file:net.jcreate.e3.tree.taglib.TreeTag.java
public static void main(String[] args) { ExtLoadTreeBuilder builder = new ExtLoadTreeBuilder(); TreeTag tag = new TreeTag(); try {//from ww w . j a v a2s. c om tag.setProperty(builder, "createDive", "true"); } catch (JspException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:com.jigsforjava.web.tags.HtmlBlockTag.java
@Override protected void postStartTagInternal(TagWriter writer) { super.postStartTagInternal(writer); try {//from w w w. ja va 2s. c om writer.forceBlock(); } catch (JspException e) { e.printStackTrace(); } }
From source file:org.terasoluna.gfw.web.token.transaction.TransactionTokenTagTest.java
/** * JspException occurs/*from w ww . j a v a 2 s. com*/ */ @Test public void testWriteTagContentTagWriter03() { // setup arguments TransactionTokenTag tag = new TransactionTokenTag(); PageContext pageContext = mock(PageContext.class); tag.setPageContext(pageContext); HttpServletRequest request = mock(HttpServletRequest.class); TransactionToken token = new TransactionToken("tokenName", "tokenkey", "tokenValue"); TagWriter tagWriter = mock(TagWriter.class); // mock behavior when((HttpServletRequest) pageContext.getRequest()).thenReturn(request); when((TransactionToken) request.getAttribute(TransactionTokenInterceptor.NEXT_TOKEN_REQUEST_ATTRIBUTE_NAME)) .thenReturn(token); // run int result = 1; try { doThrow(new JspException()).when(tagWriter).startTag(anyString()); result = tag.writeTagContent(tagWriter); } catch (JspException e) { e.printStackTrace(); } assertThat(result, is(1)); }
From source file:com.jigsforjava.web.tags.HtmlTag.java
@Override public int doEndTag() { try {/* w ww. j a v a 2s . c om*/ writer.endTag(); } catch (JspException e) { e.printStackTrace(); } return EVAL_PAGE; }
From source file:org.apache.struts2.views.jsp.IteratorTagTest.java
public void testMapIterator() { Foo foo = new Foo(); HashMap map = new HashMap(); map.put("test1", "123"); map.put("test2", "456"); map.put("test3", "789"); foo.setMap(map);/* ww w . j a va 2 s . co m*/ stack.push(foo); tag.setValue("map"); int result = 0; try { result = tag.doStartTag(); } catch (JspException e) { e.printStackTrace(); fail(); } assertEquals(TagSupport.EVAL_BODY_INCLUDE, result); assertEquals(4, stack.size()); assertTrue(stack.getRoot().peek() instanceof Map.Entry); try { result = tag.doAfterBody(); } catch (JspException e) { e.printStackTrace(); fail(); } assertEquals(TagSupport.EVAL_BODY_AGAIN, result); assertEquals(4, stack.size()); assertTrue(stack.getRoot().peek() instanceof Map.Entry); try { result = tag.doAfterBody(); } catch (JspException e) { e.printStackTrace(); fail(); } assertEquals(TagSupport.EVAL_BODY_AGAIN, result); assertEquals(4, stack.size()); assertTrue(stack.getRoot().peek() instanceof Map.Entry); try { result = tag.doAfterBody(); } catch (JspException e) { e.printStackTrace(); fail(); } assertEquals(TagSupport.SKIP_BODY, result); assertEquals(3, stack.size()); }
From source file:org.apache.struts2.views.jsp.IteratorTagTest.java
public void testStatus() { Foo foo = new Foo(); foo.setArray(new String[] { "test1", "test2", "test3" }); stack.push(foo);//ww w. j a va 2 s .c o m tag.setValue("array"); tag.setStatus("fooStatus"); int result = 0; try { result = tag.doStartTag(); } catch (JspException e) { e.printStackTrace(); fail(); } assertEquals(result, TagSupport.EVAL_BODY_INCLUDE); assertEquals("test1", stack.getRoot().peek()); assertEquals(4, stack.size()); IteratorStatus status = (IteratorStatus) context.get("fooStatus"); assertNotNull(status); assertFalse(status.isLast()); assertTrue(status.isFirst()); assertEquals(0, status.getIndex()); assertEquals(1, status.getCount()); assertTrue(status.isOdd()); assertFalse(status.isEven()); try { result = tag.doAfterBody(); } catch (JspException e) { e.printStackTrace(); fail(); } assertEquals(result, TagSupport.EVAL_BODY_AGAIN); assertEquals("test2", stack.getRoot().peek()); assertEquals(4, stack.size()); status = (IteratorStatus) context.get("fooStatus"); assertNotNull(status); assertFalse(status.isLast()); assertFalse(status.isFirst()); assertEquals(1, status.getIndex()); assertEquals(2, status.getCount()); assertFalse(status.isOdd()); assertTrue(status.isEven()); try { result = tag.doAfterBody(); } catch (JspException e) { e.printStackTrace(); fail(); } assertEquals(result, TagSupport.EVAL_BODY_AGAIN); assertEquals("test3", stack.getRoot().peek()); assertEquals(4, stack.size()); status = (IteratorStatus) context.get("fooStatus"); assertNotNull(status); assertTrue(status.isLast()); assertFalse(status.isFirst()); assertEquals(2, status.getIndex()); assertEquals(3, status.getCount()); assertTrue(status.isOdd()); assertFalse(status.isEven()); }
From source file:org.apache.struts2.views.jsp.IteratorTagTest.java
protected void validateCounter(Object[] expectedValues) throws JspException { List values = new ArrayList(); try {/* w ww .j ava2s . c o m*/ int result = tag.doStartTag(); assertEquals(result, TagSupport.EVAL_BODY_INCLUDE); values.add(stack.getRoot().peek()); } catch (JspException e) { e.printStackTrace(); fail(); } while (tag.doAfterBody() == TagSupport.EVAL_BODY_AGAIN) { values.add(stack.getRoot().peek()); } assertEquals(expectedValues.length, values.size()); ListUtils.isEqualList(Arrays.asList(expectedValues), values); }
From source file:org.apache.struts2.views.jsp.IteratorTagTest.java
private void iterateThreeStrings() { int result = 0; try {/* w ww. j a va 2 s . co m*/ result = tag.doStartTag(); } catch (JspException e) { e.printStackTrace(); fail(); } assertEquals(result, TagSupport.EVAL_BODY_INCLUDE); assertEquals("test1", stack.getRoot().peek()); assertEquals(4, stack.size()); try { result = tag.doAfterBody(); } catch (JspException e) { e.printStackTrace(); fail(); } assertEquals(result, TagSupport.EVAL_BODY_AGAIN); assertEquals("test2", stack.getRoot().peek()); assertEquals(4, stack.size()); try { result = tag.doAfterBody(); } catch (JspException e) { e.printStackTrace(); fail(); } assertEquals(result, TagSupport.EVAL_BODY_AGAIN); assertEquals("test3", stack.getRoot().peek()); assertEquals(4, stack.size()); try { result = tag.doAfterBody(); } catch (JspException e) { e.printStackTrace(); fail(); } assertEquals(result, TagSupport.SKIP_BODY); assertEquals(3, stack.size()); }
From source file:org.apache.struts2.views.jsp.IteratorTagTest.java
private void validateSkipBody() { int result = 0; try {//from w w w . ja v a 2 s .c o m result = tag.doStartTag(); } catch (JspException e) { e.printStackTrace(); fail(); } assertEquals(result, TagSupport.SKIP_BODY); try { result = tag.doEndTag(); } catch (JspException e) { e.printStackTrace(); fail(); } }