|
Hi ~~
I test a integration testing with Cactus, then there is
a situation cause exceptional event.
Situation :
JDK 1.4.1_03
Cactus 1.4.1
If there is a test method inside the testcase ...
JavaBean :
public class A1 {
private final ServletContext context;
private HttpServletRequest request; private HttpServletResponse response;
... ... ...
public void F1 ( ) {
ServletContext tContext =
this.getContext();
tContext.getRequestDispatcher("/webpage1.jsp").forward(this.request, this.response); }
}
webpage.jsp :
A1 a1 = new A1(this.context, this.request,
this.response) ;
a1.F1( ) ;
then I execute TestCase1 :
public class TestCase1 extend JspTestCase {
public void testJsp ( ) {
... ... ...
pageContext.forward("/webpage.jsp");
... ... ... }
} Result in :
java.lang.ClassCastException
at
org.apache.cactus.server.RequestDispatcherWrapper.dispatch179_forward(RequestDispatcherWrapper.java;org/apache/cactus/util/log/LogAspect.aj(1k):102)
at
org.apache.cactus.server.RequestDispatcherWrapper.around179_forward(RequestDispatcherWrapper.java;org/apache/cactus/util/log/LogAspect.aj(1k):1156)
at
org.apache.cactus.server.RequestDispatcherWrapper.forward(RequestDispatcherWrapper.java;org/apache/cactus/util/log/LogAspect.aj(1k):99)
but I execute TestCase2 :
public class TestCase2 extend JspTestCase {
public void testJsp ( ) {
... ... ...
A1 a1 = new A1(this.context, this.request,
this.response) ;
a1.F1( )
; ... ... ... }
} Result in : OK !
What happen that forward (request, response )
methd of pageContext in the test method ?
Do the situation mean I can't use JavaBean to do forward in cactus ?
Regrad
Allan |
- RE: How ClassCastException causing ? AllanHuang 英旗
- RE: How ClassCastException causing ? Vincent Massol
