HTML 4.01 Strict compliant meta redirect

Last Modified: Wed, 29 Jun 2011 16:14:26 +0000 ; Created: Mon, 20 Dec 2010 21:46:19 +0000

This has been validated with http://validator.w3.org/check
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
        <head>
                <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
                <meta http-equiv="refresh" content="0;url=/ENTER-URL-HERE/">
                <title>Redirect</title>
        </head>
        <body>
                <p>
                        <a href="/ENTER-URL-HERE/">/ENTER-URL-HERE/</a>
                </p>
        </body>
</html>

If you want to use this in a Java JSP web application with a way to dynamically pass in the redirect URL from a servlet (not a request parameter as that would be insecure) you can use the following code below in a your-redirect.jspx file (note that this uses XML syntax for compile time parsing validation):

<?xml version="1.0" encoding="UTF-8" ?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1">
    <jsp:directive.page language="java"
        contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" />
        
    <jsp:text><![CDATA[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">]]></jsp:text>

<!-- We use JSPX (xml) for our coding, but this is technically Strict HTML 4.01 versus XHTML to support old browsers
	Since the web container wants to parse valid XML we must escape HTML entities that are self-closing like <meta>
 -->

<html>
        <head>
                <jsp:text><![CDATA[<meta http-equiv="Content-type" content="text/html;charset=UTF-8">]]></jsp:text>
                <jsp:text><![CDATA[<meta http-equiv="refresh" content="0;url=${requestScope.redirectUrl}">]]></jsp:text>
                <title>Redirect</title>
        </head>
        <body>
                <p>
                        <a href="${requestScope.redirectUrl}">${requestScope.redirectUrl}</a>
                </p>
        </body>
</html>

</jsp:root>