jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From AllanHuang 英旗 <allanhu...@dsc.com.tw>
Subject How ClassCastException causing ?
Date Mon, 07 Jul 2003 07:41:41 GMT
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




Mime
View raw message