HTTPUnit does not find JSP pages

In my HttpServlet I redirect the request using the following:
request.getRequestDispatcher("/testpage.jsp").forward(request, response);

Then in my HTTPUnit TestCase I have the following:
public void testGet() throws Exception
{
        ServletRunner sr = new ServletRunner(new File(
            "WebContent/WEB-INF/web.xml"));
        ServletUnitClient client = sr.newClient();

        WebResponse response = client
            .getResponse("http://localhost:8080/MyRecord?username=tester");
        Assert.assertEquals(response.getResponseCode(),
            HttpServletResponse.SC_OK);
}

The tests works fine until it reaches the request redirection line in my servlet. It then fails with the following error:
com.meterware.httpunit.HttpInternalErrorException: Error on HTTP request: 500 org.apache.jasper.JasperException: C:\Documents and Settings\shahla\MyWorkspace\MyProject\WEB-INF\web.xml (The system cannot find the path specified) [http://localhost:8080/MyRecord?username=tester]
      at com.meterware.servletunit.ServletUnitClient.newResponse(ServletUnitClient.java:121)
      at com.meterware.httpunit.WebWindow.getResource(WebWindow.java:164)
      at com.meterware.httpunit.WebWindow.getSubframeResponse(WebWindow.java:128)
      at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:121)
      at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:102)
      at com.meterware.httpunit.WebClient.getResponse(WebClient.java:87)
      at test.LoadRecordTest.testGet(LoadRecordTest.java:45)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at junit.framework.TestCase.runTest(TestCase.java:154)
      at junit.framework.TestCase.runBare(TestCase.java:127)
      at junit.framework.TestResult$1.protect(TestResult.java:106)
      at junit.framework.TestResult.runProtected(TestResult.java:124)
      at junit.framework.TestResult.run(TestResult.java:109)
      at junit.framework.TestCase.run(TestCase.java:118)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

My web.xml has the following:
<servlet>
      <description></description>
      <display-name>LoadRecordServlet</display-name>
      <servlet-name>LoadRecordServlet</servlet-name>
      <servlet-class>test.LoadRecordServlet</servlet-class>
</servlet>
<servlet-mapping>
      <servlet-name>LoadRecordServlet</servlet-name>
      <url-pattern>/MyRecord</url-pattern>
</servlet-mapping>

The test passes when I commented out the line that redirects the request. Do I have to do something special to allow ServletUnitClient in HTTPUnit to follow redirections? Autoredirect is already set to true.

Any help is greatly appreciated.
salmasriAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bloodredsunCommented:
It's not a redirection but an internal forward. A redirection invovles a response being send to the browser saying that the content has temporarily moved -  HTTP code 307.
Because the servlet does not actually do the response, I think you need to implement what is shown here http://httpunit.sourceforge.net/doc/servletunit-intro.html in the section entitled "Testing Servlet Internals"
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.