I made following JSP.

<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"; %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"; %>

  <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: taglibs-user-unsubscr...@tomcat.apache.org
For additional commands, e-mail: taglibs-user-h...@tomcat.apache.org

Reply via email to