Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Http redirect question.

Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
    Bookmark Topic Watch Topic
  • New Topic