tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kazuaki Miyauchi <>
Subject How to convert String to Date in EL?
Date Mon, 19 Aug 2019 03:45:32 GMT
 I made following JSP.

<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="" %>
<%@ taglib prefix="sql" uri="" %>

  <title>Insert Date</title>

<c:catch var="ex">
<sql:setDataSource dataSource="jdbc/kome" var="kome"/>
<sql:update var="stmt" dataSource="${kome}">
 insert into test values(?,?)
 <sql:dateParam value="2019-8-19" type="DATE"/>
 <sql:param value="Good Day"/>

<c:if test="${not empty ex}">
 <c:out value="${ex}" />

Table was simply made as following.
create table test (when_cause date, how text);

 Then, I got following error in tomcat-9.0.22.
org.apache.jasper.JasperException: Unable to convert string
[2019-8-19] to class [java.util.Date] for attribute [value]: [Property
Editor not registered with the PropertyEditorManager]

 How to convert String date data to Date type?

 After changing as following, it works.
But, it's not easily readable when making complicated sql.

<sql:update var="stmt" dataSource="${kome}">
 insert into test values('2019-8-19',?)
 <sql:param value="Good Day"/>

Regards,                         Kazuaki Miyauchi, Japan

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message