Krt_Malta
Krt_Malta

Reputation: 9465

Blank Page on Redirect View

I've bumped into a strange problem.

I have a Spring Controller. Inside it I check for a particular condition and if true I execute a redirect to another controller like this:

return new ModelAndView(new RedirectView(url));

The problem is that a blank page is being displayed. Very strangely then, when I view the source of the blank page, I see all the HTML there.

Any ideas, what's wrong please?

Upvotes: 4

Views: 3267

Answers (3)

PHP Avenger
PHP Avenger

Reputation: 1801

One reason could be your status code on redirect is not 200, please confirm from your "browser" console/network

you can check your code as well if you are deliberately setting HTTP status code to 201 or any other.

Upvotes: 0

blong824
blong824

Reputation: 4030

Might be an ovbvious answer but check your logs for any exceptions. I had a page do something similiar to this only to realize that I caught some error but did not display it on the screen.

Upvotes: 1

kensen john
kensen john

Reputation: 5519

Make sure there are no javascript exceptions.

In some webpages, javascript may be used to show the body or div only after the page has loaded all data. If there is a javascript exception, it might stop execution and the call to show the body/div may never get executed.

There may be other reasons in your case, but this does happen once in a while.

Upvotes: 1

Related Questions