I think Cactus (v1.0) creates the session for the session variable, but this is never set for the pageContext. So if you test a JSP tag that takes the pageContext, it can't get the session. PageContext doesn't have a method to set the session. You would have to call initialize with all the correct parameters. I also had to edit the redirector.jsp to get this working. Ignore this if things have changed since v1.0.
David --- Nicholas Lesiecki <[EMAIL PROTECTED]> wrote: > It's probably the order of steps. The pageContext > might be created (with a > null session) before Cactus creates the session > based on the user's > "automaticSession" value. > > I might get a chance to write a unit test for this > in the next couple of > days. > > Cheers, > > Nick > > -----Original Message----- > From: Vincent Massol [mailto:[EMAIL PROTECTED]] > Sent: Saturday, October 13, 2001 4:55 AM > To: [EMAIL PROTECTED] > Subject: Re: pageContext.getSession(); > > > Hi Eric, > > ----- Original Message ----- > From: "Eric Walker" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Friday, October 12, 2001 4:49 PM > Subject: pageContext.getSession(); > > > > Hi > > > > I have a JspTestCase that calls > > pageContext.getSession() in setup. this value is > > always null. any ideas? > > > > yes, I have an idea ... a bug ! I have reproduced > the problem. What I wanted > to do is the following : > - in redirector.jsp, set session to false so that no > session is created at > that time. This is because the creation of the > session depends whether the > user has set setAutomaticSession to true or false > - internally, create the session by calling > HttpServletRequest.getSession(true) if automatic > session is true > > For some reason it does not work and need to be > corrected. In the meantime, > if you wish to progress with your tests, simply edit > redirector.jsp and > modfiy session="false" for session="true" > > Could you create a bug report for this > (http://nagoya.apache.org/bugzilla/) > ? Thanks a lot > > Anyone knows why it is not working ? > -Vincent > > > Thanks > > Eric > > > > > > public void setUp() throws JspException > > { . > > . > > . > > > > // why is this null? > > > assertTrue(null!=pageContext.getSession()); > > > > . > > . > > . > > } > > > > public void begin10HitsQuery(WebRequest > request) > > { > > request.setAutomaticSession(true); > > } > > Note: not needed as this is the default. > > > > > > > > > __________________________________________________ > > Do You Yahoo!? > > Make a great connection at Yahoo! Personals. > > http://personals.yahoo.com > > > __________________________________________________ Do You Yahoo!? Make a great connection at Yahoo! Personals. http://personals.yahoo.com
