You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by Gopal Ram <gr...@yahoo.com> on 2002/04/02 22:56:43 UTC

Null

Hi,

I am new to Cactus. I am testing the servlet with
Cactus. My Servlet gets the PageContext from the
JSPxFactory. while doing so I am getting a
NullPointerException 

at
org.apache.jasper.runtime.PageContextImpl._initialize(PageContextImpl.java:163)
at
org.apache.jasper.runtime.PageContextImpl.initialize(PageContextImpl.java:149)
at
org.apache.jasper.runtime.JspFactoryImpl.getPageContext(JspFactoryImpl.java:99)

Here is the Code Snippet which trows the exception

      _jspxFactory = JspFactory.getDefaultFactory();
     
response.setContentType("text/html;charset=ISO-8859-1");
      pageContext =
_jspxFactory.getPageContext(servlet, request,
response,"", true, 8192, true);

      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      writer = pageContext.getResponse().getWriter();

My question how do I set the pageContext I have in the
Cactus client side. Please help..

Thanks
gram 

__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://http://taxes.yahoo.com/

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Null

Posted by Gopal Ram <gr...@yahoo.com>.
Vincent,

I was not doing it properly. Now I am extending from
JspTestCase to test the view and it works fine now.

Thanks
Gopal
--- Vincent Massol <vm...@octo.com> wrote:
> Gopal,
> 
> Are you testing a servlet or a jsp page/taglib ? Are
> you extending
> ServletTestCase or JspTestCase ?
> 
> Why are you using :
> 
> public void testXXX()
> {
>   _jspxFactory = JspFactory.getDefaultFactory();
>   pageContext = _jspxFactory.getPageContext(servlet,
> request,
> response,"", true, 8192, true);
> 
>   pageContext = ...
> }
> 
> instead of :
> 
> public void testXXX()
> {
>   pageContext = ...
> }
> 
> ?
> 
> Thanks
> -Vincent
> 
> > -----Original Message-----
> > From: Gopal Ram [mailto:gramanuj2001@yahoo.com]
> > Sent: 02 April 2002 21:57
> > To: cactus-user@jakarta.apache.org
> > Subject: Null
> > 
> > Hi,
> > 
> > I am new to Cactus. I am testing the servlet with
> > Cactus. My Servlet gets the PageContext from the
> > JSPxFactory. while doing so I am getting a
> > NullPointerException
> > 
> > at
> >
>
org.apache.jasper.runtime.PageContextImpl._initialize(PageContextImpl.ja
> va
> > :163)
> > at
> >
>
org.apache.jasper.runtime.PageContextImpl.initialize(PageContextImpl.jav
> a:
> > 149)
> > at
> >
>
org.apache.jasper.runtime.JspFactoryImpl.getPageContext(JspFactoryImpl.j
> av
> > a:99)
> > 
> > Here is the Code Snippet which trows the exception
> > 
> >       _jspxFactory =
> JspFactory.getDefaultFactory();
> > 
> >
>
response.setContentType("text/html;charset=ISO-8859-1");
> >       pageContext =
> > _jspxFactory.getPageContext(servlet, request,
> > response,"", true, 8192, true);
> > 
> >       application =
> pageContext.getServletContext();
> >       config = pageContext.getServletConfig();
> >       session = pageContext.getSession();
> >       out = pageContext.getOut();
> >       writer =
> pageContext.getResponse().getWriter();
> > 
> > My question how do I set the pageContext I have in
> the
> > Cactus client side. Please help..
> > 
> > Thanks
> > gram
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Tax Center - online filing with TurboTax
> > http://http://taxes.yahoo.com/
> > 
> > --
> > To unsubscribe, e-mail:   <mailto:cactus-user-
> > unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> <mailto:cactus-user-
> > help@jakarta.apache.org>
> > 
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Null

Posted by Vincent Massol <vm...@octo.com>.
Gopal,

Are you testing a servlet or a jsp page/taglib ? Are you extending
ServletTestCase or JspTestCase ?

Why are you using :

public void testXXX()
{
  _jspxFactory = JspFactory.getDefaultFactory();
  pageContext = _jspxFactory.getPageContext(servlet, request,
response,"", true, 8192, true);

  pageContext = ...
}

instead of :

public void testXXX()
{
  pageContext = ...
}

?

Thanks
-Vincent

> -----Original Message-----
> From: Gopal Ram [mailto:gramanuj2001@yahoo.com]
> Sent: 02 April 2002 21:57
> To: cactus-user@jakarta.apache.org
> Subject: Null
> 
> Hi,
> 
> I am new to Cactus. I am testing the servlet with
> Cactus. My Servlet gets the PageContext from the
> JSPxFactory. while doing so I am getting a
> NullPointerException
> 
> at
>
org.apache.jasper.runtime.PageContextImpl._initialize(PageContextImpl.ja
va
> :163)
> at
>
org.apache.jasper.runtime.PageContextImpl.initialize(PageContextImpl.jav
a:
> 149)
> at
>
org.apache.jasper.runtime.JspFactoryImpl.getPageContext(JspFactoryImpl.j
av
> a:99)
> 
> Here is the Code Snippet which trows the exception
> 
>       _jspxFactory = JspFactory.getDefaultFactory();
> 
> response.setContentType("text/html;charset=ISO-8859-1");
>       pageContext =
> _jspxFactory.getPageContext(servlet, request,
> response,"", true, 8192, true);
> 
>       application = pageContext.getServletContext();
>       config = pageContext.getServletConfig();
>       session = pageContext.getSession();
>       out = pageContext.getOut();
>       writer = pageContext.getResponse().getWriter();
> 
> My question how do I set the pageContext I have in the
> Cactus client side. Please help..
> 
> Thanks
> gram
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Tax Center - online filing with TurboTax
> http://http://taxes.yahoo.com/
> 
> --
> To unsubscribe, e-mail:   <mailto:cactus-user-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:cactus-user-
> help@jakarta.apache.org>
> 




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>