users@glassfish.java.net

Problem with <fmt:formatDate>

From: <glassfish_at_javadesktop.org>
Date: Sun, 25 Mar 2007 11:22:57 PST

I am trying to deploy a very simple JSP using the JSTL <fmt:formatDate> tag. I am using Glassfish V2 beta.

The body of the JSP is:
[code]
<%@ page language="java" contentType="text/html; charset=UTF-8"
  pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>FormatDate</title>
</head>
<body>
<jsp:useBean id="rightNow" scope="page" class="java.util.Date" />
<fmt:formatDate value="${rightNow}" />
</body>
</html>
[/code]
It follows an example in the Java EE 5 tutorial pretty closely (the example can be found in page 194 of the PDF version of the Java EE 5 tutorial).

When I deploy the war file containing the JSP and point the browser to it, I get the following error message:

org.apache.jasper.JasperException: /formatDate.jsp(12,0) PWC6236: According to TLD or attribute directive in tag file, attribute value does not accept any expressions

note The full stack traces of the exception and its root causes are available in the Sun Java System Application Server 9.1 logs.

From the example, it looks like the value attribute should accept expressions. I opened appserv-jstl.jar, which contains JSTL tlds and code, and opened the version of fmt.tld inside that jar file. The relevant section looks like this:

[code]
<tag>
    <description>
        Formats a date and/or time using the supplied styles and pattern
    </description>
    <name>formatDate</name>
    <tag-class>org.apache.taglibs.standard.tag.rt.fmt.FormatDateTag</tag-class>
    <body-content>empty</body-content>
    <attribute>
        <description>
Date and/or time to be formatted.
        </description>
        <name>value</name>
        <required>true</required>
        <rtexprvalue>true</rtexprvalue>
    </attribute>
[/code]

It is my understanding that if rtexprvalue is set to true, then the attribute should accept EL expressions.

Did I just find a bug in Glassfish or am I doing something wrong?

Any help greatly appreciated.
[Message sent by forum member 'eraser' (eraser)]

http://forums.java.net/jive/thread.jspa?messageID=209779