jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Franz Roth" <franzr...@gmx.de>
Subject Re: How to use JSPRedirector
Date Tue, 29 Aug 2006 10:27:46 GMT
Hi,
try the following:

- add a leading slash to yout Jsp-File-Entry  
[<jsp-file>/Test/jspRedirector.jsp</jsp-file>]
- set an loadonstartup element for the servlet  
[<load-on-startup>21</load-on-startup>]
- assure the file jspRedirector.jsp is physical at  
[yourwebapp]/Test/jspRedirector.jsp

bye
	

On Tue, 29 Aug 2006 12:18:20 +0200, Sushma <era_sushma@yahoo.co.in> wrote:

> Hi,
>
> I'm testing a jsp page for a table contents, below is
> my testcase class.
>
> import com.meterware.httpunit.WebResponse;
> import com.meterware.httpunit.WebTable;
> import junit.framework.*;
> import org.apache.cactus.JspTestCase;
>
> public class HTMLSampleTestCase extends JspTestCase {
>
>       public void testJspOutput() {
>
>             try {
>             	
>             	
>             	pageContext.forward("/hello.jsp");
>
>            } catch (Throwable e) {
>
>                   assertTrue("Error: Exception while
> forwarding the request:\n" + e,false);
>            }
>       }
>
>      public static Test suite()
>       {
>     	
>     	  return new TestSuite(HTMLSampleTestCase.class);
>      }
>
>       public void endJspOutput(WebResponse res)throws
> Exception {
>
>    	  WebTable table = res.getTableWithID("table1");
> 	
>
>        assertEquals("rows", 1, table.getRowCount());
>
>
>       }
>
> }
>
>
> The other changes I hv done is... added following code
> in web.xml
>
> <servlet>
>   <servlet-name>ServletRedirector</servlet-name>
> <servlet-class>org.apache.cactus.server.ServletTestRedirector</servlet-class>
>   <init-param>
>     <param-name>param1</param-name>
>     <param-value>value1 used for testing</param-value>
>   </init-param>
> </servlet>
>
> <servlet>
>    <servlet-name>JspRedirector</servlet-name>
>       <jsp-file>Test/jspRedirector.jsp</jsp-file>
>           <init-param>
>             <param-name>param1</param-name>
>             <param-value>value1 used for
> testing</param-value>
>           </init-param>
> </servlet>
>
> <servlet>
>   <servlet-name>ServletTestRunner</servlet-name>
> <servlet-class>org.apache.cactus.server.runner.ServletTestRunner</servlet-class>
> </servlet>
>
>
> <servlet-mapping>
>     <servlet-name>ServletRedirector</servlet-name>
>     <url-pattern>/ServletRedirector</url-pattern>
> </servlet-mapping>
>
> <servlet-mapping>
>     <servlet-name>JspRedirector</servlet-name>
>     <url-pattern>/JspRedirector/</url-pattern>
> </servlet-mapping>
>
> <servlet-mapping>
>     <servlet-name>ServletTestRunner</servlet-name>
>     <url-pattern>/ServletTestRunner</url-pattern>
> </servlet-mapping>
>
>
>
> Also I hv placed the jspRedirector.jsp file in my
> application folder,
> I'm runing the application through this URL
> "http://localhost:8080/Test/ServletTestRunner?suite=HTMLSampleTestCase"
>
> Now I'm getting a Http status 404  error.
> and I dont know should I place the cactus.properties
> file or not if so where should I place?
>
> please help me... I'm stuck on this since long time
>
> Thanks and regards,
> Suresh
>
>
>
>
> 		
> __________________________________________________________
> Yahoo! India Answers: Share what you know. Learn something new
> http://in.answers.yahoo.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org
>



-- 
franz roth
schulstr. 15
72669 Unterensingen

Mime
View raw message