Examples of JspFragment


Examples of javax.servlet.jsp.tagext.JspFragment

                if(parentTag != null) {
                    tag.setParent(parentTag);
                }
                setupTag(tag, args, pageContext.getObjectWrapper());
                if(body != null) {
                    tag.setJspBody(new JspFragment() {
                        public JspContext getJspContext() {
                            return pageContext;
                        }
                       
                        public void invoke(Writer out) throws JspException, IOException {
View Full Code Here

Examples of javax.servlet.jsp.tagext.JspFragment

        }


        try {        

            JspFragment f = getJspBody();
            if (f != null) {
                f.invoke(out);
            }

        } catch (java.io.IOException ex) {
            throw new JspException("Error in RequestTag tag", ex);
        }
View Full Code Here

Examples of javax.servlet.jsp.tagext.JspFragment

   <P>The body of this tag cannot contain scriptlets or scriptlet expressions.
   If this tag has no body, or has an empty body, then <tt>null</tt> is returned.
  */
  private String getBody() throws IOException, JspException {
    String result = null;
    JspFragment body = getJspBody();
    if( body != null ){
      StringWriter writer = new StringWriter();
      getJspBody().invoke(writer);
      writer.flush();
      result = writer.toString();
View Full Code Here

Examples of javax.servlet.jsp.tagext.JspFragment

import org.junit.Test;

public class JspAutotagRuntimeTest {
    @Test
    public void testCreateRequest() {
        JspFragment jspBody = createMock(JspFragment.class);
        PageContext pageContext = createMock(PageContext.class);
        JspTag parent = createMock(JspTag.class);
        ApplicationContext applicationContext = createMock(ApplicationContext.class);
        HttpServletRequest httpServletRequest = createMock(HttpServletRequest.class);
        HttpServletResponse httpServletResponse = createMock(HttpServletResponse.class);
View Full Code Here

Examples of javax.servlet.jsp.tagext.JspFragment

        verify(jspBody, pageContext, parent, applicationContext, httpServletRequest, httpServletResponse);
    }

    @Test
    public void testCreateModelBody() {
        JspFragment jspBody = createMock(JspFragment.class);
        JspContext jspContext = createMock(JspContext.class);
        JspTag parent = createMock(JspTag.class);
        JspWriter writer = createMock(JspWriter.class);
        expect(jspContext.getOut()).andReturn(writer);
        replay(jspBody, jspContext, parent, writer);
View Full Code Here

Examples of javax.servlet.jsp.tagext.JspFragment

        verify(jspBody, jspContext, parent, writer);
    }

    @Test(expected = UnsupportedOperationException.class)
    public void testGetParameter() {
        JspFragment jspBody = createMock(JspFragment.class);
        JspContext jspContext = createMock(JspContext.class);
        JspTag parent = createMock(JspTag.class);
        replay(jspBody, jspContext, parent);
        JspAutotagRuntime runtime = new JspAutotagRuntime();
        runtime.setJspBody(jspBody);
View Full Code Here

Examples of javax.servlet.jsp.tagext.JspFragment

     * @throws IOException If something goes wrong.
     * @throws JspException If something goes wrong.
     */
    @Test
    public void testEvaluateWriter() throws JspException, IOException {
        JspFragment body = createMock(JspFragment.class);
        PageContext pageContext = createMock(PageContext.class);
        JspWriter writer = createMock(JspWriter.class);

        expect(pageContext.getOut()).andReturn(null);
        body.invoke(writer);

        replay(body, pageContext, writer);
        JspModelBody modelBody = new JspModelBody(body, pageContext);
        modelBody.evaluate(writer);
        verify(body, pageContext, writer);
View Full Code Here

Examples of javax.servlet.jsp.tagext.JspFragment

     * @throws JspException If something goes wrong.
     */
    @Test(expected = IOException.class)
    public void testEvaluateWriterException() throws JspException, IOException {
        PageContext pageContext = createMock(PageContext.class);
        JspFragment body = createMock(JspFragment.class);
        JspWriter writer = createMock(JspWriter.class);

        expect(pageContext.getOut()).andReturn(null);
        body.invoke(writer);
        expectLastCall().andThrow(new JspException());

        replay(body, pageContext, writer);
        try {
            JspModelBody modelBody = new JspModelBody(body, pageContext);
View Full Code Here

Examples of javax.servlet.jsp.tagext.JspFragment

        JspContext context = getJspContext();
        context.setAttribute("day", tok.nextToken() );
        context.setAttribute("month", tok.nextToken() );
        context.setAttribute("year", tok.nextToken() );

        JspFragment fragment = getJspBody();
        fragment.invoke(null);
    }
View Full Code Here

Examples of javax.servlet.jsp.tagext.JspFragment

    public void doTag() throws JspException {
        JspWriter out = getJspContext().getOut();

        try {

            JspFragment f = getJspBody();
            if (f != null) {
                f.invoke(out);
            }



        } catch (java.io.IOException ex) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.