Your code looks good, and I couldn't figure out why it wouldn't work, so I created a simple JSP to
test it. Here is my test page:
It works fine. If I set redirect to true, the page is redirected to the specified action. If I set redirect to false, the original page is shown.
Check to see if there are differences between your page and this test page. It may give you a clue as to what you need to change.
One thing to note: The redirect must be the very first output on the page. If you attempt to output anything else (headers, body tag, etc) the redirect will fail.