Use a JSP (Java) Redirect Script

This article will walk you through the process of using a 301 redirect script in JSP (Java).  The 301 redirect  is a very efficient method of webpage redirection.  More importantly, it is search engine friendly. 

In order to utilize a 301 redirect, you will need to add the following JSP code to a page on your site (replacing http://domain.com with the actual destination URL):

<%
response.setStatus(301);
response.setHeader( "Location", "http://domain.com/" );
response.setHeader( "Connection", "close" );
%>

In most cases, you will need to insert this script on a default document such as index.php or default.php in order to redirect a fully-qualified domain name.

NOTE: This script can be inserted in your web root or a sub-directory.