Tomcat 5.0.11 EL Feature is not working !!

kmthien

Senior member
Oct 8, 2002
363
0
0
Hi Guys,


MillenniumCounter.java
============================

package com.wrox.utilities;

import java.util.*;
import java.text.SimpleDateFormat;

public class MillenniumCounter
{
private SimpleDateFormat dateFormat;
private Calendar targetDate;

public MillenniumCounter()
{
dateFormat = new SimpleDateFormat("EEE, dd MMMM yyyy");

targetDate = Calendar.getInstance();
targetDate.set(targetDate.YEAR, 3000);
targetDate.set(targetDate.MONTH, 0);
targetDate.set(targetDate.DATE, 1);
targetDate.set(targetDate.AM_PM, 0);
targetDate.set(targetDate.HOUR, 0);
targetDate.set(targetDate.MINUTE, 0);
targetDate.set(targetDate.SECOND, 0);
}

public String getToday()
{
return dateFormat.format(new Date());
}

public long getDays()
{
Calendar now = Calendar.getInstance();
if (now.after(targetDate))
return 0;
else
{
long milliseconds = (targetDate.getTimeInMillis()
- now.getTimeInMillis());
long seconds = milliseconds / 1000;
long minutes = seconds / 60;
long hours = minutes / 60;
long days = hours / 24;

return days;
}
}
}


MillenniumCounter.jsp
====================================

<html>
<head><title>Millennium Counter</title></head>
<body>

<jsp:useBean id="counter" scope="page"
class="com.wrox.utilities.MillenniumCounter"/>

The current date is ${counter.today}
<p/>
Only ${counter.days} days until the new millennium!

</body>
</html>


When I display the page, the result show :


The current date is ${counter.today}
Only ${counter.days} days until the new millennium!


Pls help !!