1.
<tr>
<td>生产日期:</td>
<td><input type="text" οnclick="WdatePicker()" name="createtime" value="<fmt:formatDate value='${items.createtime}' pattern='yyyy-MM-dd hh:mm:ss'/>"/></td>
</tr>
2.
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<fmt:formatDate var="newdate" value="${items.createtime}" pattern="yyyy-MM-dd"/>
<input type="text" name="newdate" value="${newdate}"/>
3.另一种
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jstl/function" %>
<input type="text" name="newdate" value="${f:substring(chardate,0,10)}"/>
4
把<%@ taglib prefix="c" uri="http://java.sun.com/jstl/fmt" %>变为:
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
原理(摘抄):应用部署运行的时候出现JSP异常, 发生在使用JSTL库的时候: According to TLD or attribute directive in tag file, attribute value does not accept any expressions,可能是因为使用了JSP2.0版本, 同时又没有使用JSTL core库的备用版本(RT库)。
最后的jsp头部页面如下:
<%@page import="java.util.Date"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt" %>
<tr>
<td>生产日期:</td>
<td><input type="text" οnclick="WdatePicker()" name="createtime" value="<fmt:formatDate value='${items.createtime}' pattern='yyyy-MM-dd hh:mm:ss'/>"/></td>
</tr>
你自己试试啦。。