jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Childers" <jchild...@hotels.com>
Subject RE: Clearing request parameters in test method
Date Tue, 10 Dec 2002 22:22:51 GMT
Unfortunately, no. Request attributes and request parameters are different beasts. That's actually
how I discovered this problem: I was using removeAttribute() and my tests were failing, when
I knew they should have been passing.

-= J

> -----Original Message-----
> From: Robertson, Jason [mailto:Jason.Robertson@acs-inc.com]
> Sent: Tuesday, December 10, 2002 4:20 PM
> To: 'Cactus Users List'
> Subject: RE: Clearing request parameters in test method
> 
> 
> ServletRequest has a removeAttribute() method, is this what 
> you're looking
> for?
> 
>    request.removeAttribute("lang");
> 
> Jason
> 
> -----Original Message-----
> From: James Childers [mailto:jchilders@hotels.com]
> Sent: Tuesday, December 10, 2002 4:01 PM
> To: cactus-user@jakarta.apache.org
> Subject: Clearing request parameters in test method
> 
> 
> All,
> 
> Reposting this question because I haven't found an answer yet.
> 
> I am looking to test a tag which sets a session attribute 
> based on a request
> parameter. I need to be able to test multiple requests in the 
> same test,
> something like the following:
> 
> public void beginTestTwice(WebRequest wRequest) {
> 	wRequest.addParameter("lang", "es");
> }
> 
> public void testTwiceWithSpanish() throws Exception {
> 	htmlTag.doStartTag();
> 	assertEquals("es", request.getSession().getAttribute("lang"));
> 
> 	// Need to clear request parameter here, otherwise following
> assertion fails
> 	assertNull(request.getParameter("lang"));
> 	htmlTag.doStartTag();
> 	assertEquals("es", request.getSession().getAttribute("lang"));
> }
> 
> The problem is that I cannot find a way to clear the request parameter
> either in the test method or the end method.
> 
> Thanks in advance,
> 
> -= James
> 
> --
> 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:   
> <mailto:cactus-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: 
> <mailto:cactus-user-help@jakarta.apache.org>
> 
> 

--
To unsubscribe, e-mail:   <mailto:cactus-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:cactus-user-help@jakarta.apache.org>


Mime
View raw message