I would try doing the fmt:parseDate prior to the c:set as follows:

<fmt:parseDate pattern='MM/dd/yyyy' value='${param.dateDue}' var="theDate"/>
<c:set target='${pageScope.myBean}' property='dateDue' value='${theDate}'/>

-----Original Message-----
From: Rob Cash [mailto:[EMAIL PROTECTED]
Sent: Friday, September 05, 2003 12:25 PM
To: [EMAIL PROTECTED]
Subject: c:set with body content throws exception


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




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to