Hi,
I'm using the Jakarta datetime tag library in a jsp with several static
includes. The whole jsp will compile, will all the includes in place, but I
get errors in the final include file, which displays information from a
database and formats the dates in the result set with Jakarta's <dt:format>
tag. The tag library information is at the top of the main jsp, and a
different include file on the page loads fine (with dates formatted as
expected), but the final include file's date fields all read "Invalid Date".
The code in my page looks like this:
// open connection and get result set, all other data in rs shows up
fine.
<% ... vBirthDate = rs.getDate("BirthDate"); ... %>
...
<dt:format pattern="MM/dd/yy"><% vBirthDate.toString()
%></dt:format>
For clarity, let me say that the scriplet inside the tag is not the first
I've tried. I tried just the variable name in expression tags, the way it is
now in expression tags, valueOf() to return a long value.. Nothing seemed to
work. I looked at the code for the tags, and the pertinent part seems to be
this:
(date = null and default_text = "Invalid Date" at this point..)
public final int doAfterBody() throws JspException
{
// Use the body of the tag as input for the date
BodyContent body = getBodyContent();
String s = body.getString().trim();
// Clear the body since we will output only the formatted
date
body.clearBody();
Date format_date = date;
if( format_date == null ) {
long time;
try {
time = Long.valueOf(s).longValue();
} catch(NumberFormatException nfe) {
date_formatted = default_text;
return SKIP_BODY;
}
format_date = new Date(time);
}
Can anyone see what I'm doing wrong?
Thanks,
Garann
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com