Get today's date in JSP and compare it to a Date variable

For starters, don't mix Scriptlets and taglibs/EL. That's just recipe for trouble. Use the one or the other and not both. Assuming that you want to go ahead with taglibs/EL, here's how you could do it:

<p>
    <jsp:useBean id="today" class="java.util.Date" />
    <b><c:out value="${today}"/></b>
</p>

<fmt:setLocale value="en_US" />
<fmt:parseDate var="testdate" value="Tue Jan 29 16:02:58 GMT 2013" pattern="EEE MMM dd HH:mm:ss z yyyy" />
<c:if test="${today.time gt testdate.time}">
    <p><b><span class="wrap">Test date is less than now.</span></b></p>
</c:if>

Note that I also fixed some strange contra-logic in variable names and descriptions.

Tags:

Date

Jsp

Jstl

El