Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Issue in returning 302 response code instead of 200 response code  RSS feed

Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While submitting the form and if the http method is POST, then instead of returning 200 response code, I will be redirecting to dummy/temp page from which it will be directed to required page, so that we will return 302 response code to avoid the caching of senstivie information.

This is working fine and in one place it's giving some strange error which is working fine without the above logic.

My dummy jsp page will have the following code for redirection.

For example:

Actual page to be redirect from servlet: empSuccess.jsp

In "empSuccess.jsp", I am using the above code for redirection to emp.jsp. It's redirecting propely and working fine. But in my emp.jsp, I am using the below javascript for excel download.
Below methos will open a popup window to display the message to the user that it's about to download the report and the form will be submitted for the biz logic. The form submission is working fine, but the download.jsp page is not diaplying and returing 404 error.

But if I am not usinf the above logic (200 instead od 302 rsp code), the download.jsp pasge is displaying properly. Any suggestion/idea on why it's not working?

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!