Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

sendRedirect causes infinite loop in index.jsp

804628Jun 15 2011 — edited Jun 17 2011
I am having trouble redirecting the user to different application in index.jsp file.

Server used: Weblogic 10.3
JSF 2 .0


Scenario:

I am trying to redirect the user to a different application url in the welcome file( index.jsp).

Whenever user types the context url of the webapplication, like below

http://myapplication:4005/AppName/

the index.jsp should be invoked .

Inside index.jsp, I am trying to redirect to an different url which is outside my application (for authentication purpose).

Index.jsp:

<% response.sendRedirect("http://otherapplication:8080/index.jsp"); return; %>

What is happening is when the server is still in the process of the starting, the index.jsp is invoked and it tries to redirect to that url. And this goes into an infinite loop.

1) My question is why is the index.jsp is getting invoked during the server startup. It should actually be called only when the user types the context url in the browser like this http://myapplication:4005/AppName/

Web.xml:
*<welcome-file-list>*
*<welcome-file>faces/newjsp.jsp</welcome-file>*
*</welcome-file-list>*

2) Also, why it goes to infinite loop. when I try to sendRedirect to a relative URL within the application is does fine. But when I try to go to different webapplication, it goes infinite loop.

Please explain.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 15 2011
Added on Jun 15 2011
1 comment
2,534 views