RequestDispatcher.forward goes to an infinite loop

Hey All,

I am trying to redirect my jsp page to a different page. Am using the forward function of the RequestDispatcher, but for some reason its entering an infinite loop. The only reason that I could site is the page re-calling itself. But i checked to see the pat of the destination jsp being passed to the dispatcher and its as expected.

I am using forward as I dont want to use redirect in my code.

The format of the file i am passing is "/myFile.jsp" and this is as expected.

Any help on this front would be greatly appreciated..

Below is the code of the calling jsp.

HTMLCookie testCookie = htmlContext.getCookie("test-cookie");

if (testCookie != null) {

String sRequestedTemplate = dnaFormData.removeString("requestTemplate");

RequestDispatcher dispatcher = getServletConfig().getServletContext().getRequestDispatcher(sRequestedTemplate);

if (dispatcher != null) {

dispatcher.forward(request, response);

}

}

else {

GymboErrorUtil.setCookieDisabledError(htmlContext);

}

[1080 byte] By [venkyfunkya] at [2007-11-27 9:51:12]
# 1

> Hey All,

>

> I am trying to redirect my jsp page to a different

> page. Am using the forward function of the

> RequestDispatcher, but for some reason its entering

> an infinite loop. The only reason that I could site

> is the page re-calling itself.

There's another. The destination jsp may be forwarding back to the original jsp !!! :)

ram.

Madathil_Prasada at 2007-7-13 0:20:13 > top of Java-index,Java Essentials,Java Programming...