Hmm, I was too fast.

>There is a pageContext.getOut() method that returns the JspWriter. I guess
>you can use that.

PageContext.getOut() returns the same JspWriter which is contained in the
JspTestCase
which brings me back to square one :-(, altough PageContext.getPage() looks
interesting... hmm...

Regards,
S�ren






                                                                                       
                             
                                                                                       
                             
                     "Vincent            To:     <[EMAIL PROTECTED]>      
                             
                     Massol"             cc:                                           
                             
                     <vmassol@octo       Subject:      Re: new 
com.sun.jsp.compiler.JspReader(                      
                     .com>                ((JspTestCase)this).out ) ?                  
                             
                                                                                       
                             
                     14-08-01                                                          
                             
                     12:25                                                             
                             
                     Please                                                            
                             
                     respond to                                                        
                             
                     cactus-user                                                       
                             
                                                                                       
                             
                                                                                       
                             
                                                                                       
                             



Hi Soren,

I have just checked the JSP 1.1 specification. Have a look at Sectio, 6.1.4
(page 117 in the spec I have). It lists all the methods available on the
pageContext object.

There is a pageContext.getOut() method that returns the JspWriter. I guess
you can use that.
Thanks
-Vincent

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, August 14, 2001 11:09 AM
Subject: new com.sun.jsp.compiler.JspReader( ((JspTestCase)this).out ) ?


I'm trying to test my custom taglibs and the code executes fine. But how do
I access the contents of the JspWriter to check that the correct output was
written? I'm sure the answer is obvious and that all I need is some fresh
air ;-)

public class MyTagTest extends JspTestCase {
     public void testMyTag()
          throws java.io.IOException, javax.servlet.ServletException {

          try {
               PrintCommentTag pct = new PrintCommentTag();  // no
bodycontent needed for this tag
               pct.setPageContext(pageContext);

               pct.setScope("request");
               pct.setColumn("addrlin1");

               pct.doStartTag();
               pct.doEndTag();

               pct.release();
               pct = null;
          } catch(JspException jspe) {
               jspe.printStackTrace();
               throw new ServletException(jspe);
          }

          // assertTrue(?);

     }
}

Regards,
S�ren Bro








Reply via email to