You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by Dos Santos <ne...@yahoo.com> on 2004/04/22 15:17:53 UTC

Problem testing JSP

Hi! I'm having some trouble forwarding to a jsp page
within a test. My web application is deployed on
Weblogic 8.1, my test case extends JspTestCase and
this is what it consists of:

First I have a beginXXX method:
public void beginCreateUser(WebRequest theRequest){
    theRequest.setURL("http://localhost:7001",
"/tellarian-core", null, null, null);       
}

Secondly I have the test:
public void testCreateUser() throws Exception {
        CreateUserValidatorBean formValidator = new
CreateUserValidatorBean();
                
        formValidator.setFirstname("A");
        formValidator.setLastname("N");
                
        request.setAttribute("formValidator",
formValidator);
       
pageContext.forward("/user/jsp/CreateUser.jsp");
}

Lastly I have the endXXX method:
public void endCreateUser(WebResponse theResponse)
throws Exception{
        System.out.println(theResponse.getDOM());
    }

Ultimately I would like to be able to perform asserts
over the resulting HTML. The thing is that for the
time being it doesn't seem to be forwarding to the
jsp. When I print out anything related to the
WebResponse it results in null and it does not create
the user. I've performed unit tests of the user
creation separate from the jsp and it works fine. I've
also navigated the web application and created a user
directly through the jsp and it works fine also.

I would truly appreciate any input.

Thanks in advance.


	
		
__________________________________
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25�
http://photos.yahoo.com/ph/print_splash

RE: Problem testing JSP

Posted by Vincent Massol <vm...@pivolis.com>.
Hi,

You seem to be doing the right thing. I see no problem in your code
below. I'd suggest you look at weblogic's logs to see what's happening
to the call to the JSP page.

Thanks
-Vincent

> -----Original Message-----
> From: Dos Santos [mailto:newbie_77@yahoo.com]
> Sent: 27 April 2004 00:08
> To: Cactus Users List
> Subject: Problem testing JSP
> 
> Hi! I'm resending this message because I haven't been
> able to solve it yet and I hope somebody can help me.
> 
> I'm having some trouble forwarding to a jsp page
> within a test. My web application is deployed on
> Weblogic 8.1, my test case extends JspTestCase and
> this is what it consists of:
> 
> First I have a beginXXX method:
> public void beginCreateUser(WebRequest theRequest){
>     theRequest.setURL("http://localhost:7001",
> "/tellarian-core", null, null, null);
> }
> 
> Secondly I have the test:
> public void testCreateUser() throws Exception {
>         CreateUserValidatorBean formValidator = new
> CreateUserValidatorBean();
> 
>         formValidator.setFirstname("A");
>         formValidator.setLastname("N");
> 
>         request.setAttribute("formValidator",
> formValidator);
> 
> pageContext.forward("/user/jsp/CreateUser.jsp");
> }
> 
> Lastly I have the endXXX method:
> public void endCreateUser(WebResponse theResponse)
> throws Exception{
>         System.out.println(theResponse.getDOM());
>     }
> 
> Ultimately I would like to be able to perform asserts
> over the resulting HTML. The thing is that for the
> time being it doesn't seem to be forwarding to the
> jsp. When I print out anything related to the
> WebResponse it results in null and it does not create
> the user. I've performed unit tests of the user
> creation separate from the jsp and it works fine. I've
> also navigated the web application and created a user
> directly through the jsp and it works fine also.
> 
> I would truly appreciate any input.
> 
> Thanks in advance.
> 
> 
> 
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Photos: High-quality 4x6 digital prints for 25¢
> http://photos.yahoo.com/ph/print_splash
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org




Problem testing JSP

Posted by Dos Santos <ne...@yahoo.com>.
Hi! I'm resending this message because I haven't been
able to solve it yet and I hope somebody can help me. 

I'm having some trouble forwarding to a jsp page
within a test. My web application is deployed on
Weblogic 8.1, my test case extends JspTestCase and
this is what it consists of:

First I have a beginXXX method:
public void beginCreateUser(WebRequest theRequest){
    theRequest.setURL("http://localhost:7001",
"/tellarian-core", null, null, null);       
}

Secondly I have the test:
public void testCreateUser() throws Exception {
        CreateUserValidatorBean formValidator = new
CreateUserValidatorBean();
                
        formValidator.setFirstname("A");
        formValidator.setLastname("N");
                
        request.setAttribute("formValidator",
formValidator);
       
pageContext.forward("/user/jsp/CreateUser.jsp");
}

Lastly I have the endXXX method:
public void endCreateUser(WebResponse theResponse)
throws Exception{
        System.out.println(theResponse.getDOM());
    }

Ultimately I would like to be able to perform asserts
over the resulting HTML. The thing is that for the
time being it doesn't seem to be forwarding to the
jsp. When I print out anything related to the
WebResponse it results in null and it does not create
the user. I've performed unit tests of the user
creation separate from the jsp and it works fine. I've
also navigated the web application and created a user
directly through the jsp and it works fine also.

I would truly appreciate any input.

Thanks in advance.



	
		
__________________________________
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25�
http://photos.yahoo.com/ph/print_splash