aspose file tools*
The moose likes Struts and the fly likes Http redirect question. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Http redirect question." Watch "Http redirect question." New topic
Author

Http redirect question.

Yogendra Joshi
Ranch Hand

Joined: Apr 04, 2006
Posts: 213
Hello all ,

I am new to Struts and its really fun working with Struts. It is very robust and effective.

I have just used <logic:redirect/> tag and faced a problem which i myself created. It says Http Redirect request failed. The reason being i have 2 pages , index and success.jsp , What i have done is i have wrote <logic:redirect href="/TestStruts/success.jsp"> in index.jsp and <logic:redirect href="/TestStruts/index.jsp"> in success.jsp.

I know this is silly and this is never going to be used in any used application in this world. What i was expecting that it would give me a StackOverFlow error , instead it said "HTTP REDIRECT REQUEST FAILED". Can someone let me know why has this happened ? Because as this is an loop and recursive it should have thrown StackOverflowError.

Any help is much appreciated. Thanks in advance for your sincere comments and advice.

Yogendra Joshi.


Meri Zindagi Hain Tab Tak.. Jab Tak Tera Sahara.... Har Taraf Tu Hi Tu Hain SAI Tera Hi Hain Nazara.....
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The <logic:redirect> tag performs an HttpServletResponse.sendRedirect() call to the URL you provide. It must be the first and only instruction that produces output executed by your JSP. Otherwise, it will fail. I suspect it may be failing because your JSP attempts to produce other output before executing this tag.

Regarding your expectations that it would produce a stack overflow, that is not accurate. A redirect is an instruction sent to the browser to redirect to a different page. Since this process is external to the JVM, it would not cause a stack overflow, but simply cause your browser to continually load one page and then the other.
[ August 31, 2006: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Http redirect question.