To do a 301 redirect on JSP pages simple modify this code for your own purposes and place it on the page you want to redirect:
<%
response.setStatus(301);
response.setHeader( “Location”, “http://www.new-url.com/” );
response.setHeader( “Connection”, “close” );
%>
However, my favorite method of doing 301 redirects is still the htaccess file.
Other 301 redirect methods:
301 redirects for PHP
301 redirects for ASP.NET
301 redirects for classic ASP

Hello,
thank you for the info.
I use the published code in my jsp but I have an error 404.
“…Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.”
Do I need to create the html file first?