tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karr, David" <David.K...@wamu.net>
Subject RE: set with body content throws exception
Date Fri, 05 Sep 2003 17:48:41 GMT
Yes, that's probably the correct approach.  Using the body content is
probably converting it from a Date back into a string.

> -----Original Message-----
> From: Siggelkow, Bill [mailto:bill.siggelkow@mirant.com] 
> 
> 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:Rob.Cash@nortelnetworks.com]
> 
> 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.ExpressionEvaluatorMa
> nager.coerce(E
> xpressionEvaluatorManager.java:177)
> 	at
> org.apache.taglibs.standard.tag.common.core.SetSupport.doEndTa
> g(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: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
> 
> 

Mime
View raw message