tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rob Cash" <Rob.C...@nortelnetworks.com>
Subject c:set with body content throws exception
Date Fri, 05 Sep 2003 16:25:08 GMT
Hello,

I'm writing a JSP page that is processing HTML form data and setting it into
a bean. One property that's causing me problems is a java.util.Date. The
parameter value comes out as a String, so I'm using fmt:parseDate to first
convert it into a java.util.Date before setting it into my bean.

My code looks like this:
    <c:set target='${pageScope.myBean}' property='dateDue'>
      <fmt:parseDate pattern='MM/dd/yyyy' value='${param.dateDue}'/>
    </c:set>

When I run my application in a debugger, I see that the fmt:parseDate is
correctly converting the parameter value into a java.util.Date, but an error
occurs when c:set tries to set the Date into my bean:

javax.servlet.jsp.JspException: Attempt to convert String "Wed Jan 01
00:00:00 EST 2003" to type "java.util.Date", but there is no PropertyEditor
for that type
	at
org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager.coerce(E
xpressionEvaluatorManager.java:177)
	at
org.apache.taglibs.standard.tag.common.core.SetSupport.doEndTag(SetSupport.j
ava:172)

In the process of debugging I discovered that the java.util.Date is
converted to a String when c:set takes it off of the body content! This
seems to make my fmt useless.

If someone can give me a pointer as to how I can get my MM/dd/yyyy date
value into my bean property that would be great. I know that I could use RT
for this, but I'm trying to stick with EL. I'm using JSTL 1.0.3.

Thanks in advance.


Cheers,
Rob




Mime
View raw message