Hi Allan,

I don�t know what's wrong. Let me try to understand your flow. Is it
TestCase1 --> webpage.jsp --> A1 --> webpage1.jsp ?

In order to help you I would need the full stack trace you're getting
(you've only shown the top part of it and I don't know where the error
is happening).

Also you mention:

webpage.jsp :
    A1 a1 = new A1(this.context, this.request, this.response) ; 
    a1.F1( ) ;

where do you get this.context, this.request and this.resppnse from?

Thanks
-Vincent

-----Original Message-----
From: AllanHuang ^�X [mailto:[EMAIL PROTECTED] 
Sent: 07 July 2003 09:42
To: [EMAIL PROTECTED]
Subject: How ClassCastException causing ?

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(Re
questDispatcherWrapper.java;org/apache/cactus/util/log/LogAspect.aj(1k):
102)
�at
org.apache.cactus.server.RequestDispatcherWrapper.around179_forward(Requ
estDispatcherWrapper.java;org/apache/cactus/util/log/LogAspect.aj(1k):11
56)
�at
org.apache.cactus.server.RequestDispatcherWrapper.forward(RequestDispatc
herWrapper.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
�
�
�


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to