我在jsp里使用了SimpleDateFormat获取时间,在控制台输出年月日 时分秒是正常的 放到表单value却获取不到时分秒了
下面是我的jsp代码
<%@page import="java.util.Date"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<script src="/AX/Resource/bootstrap/js/bootstrap.min.js"></script>
Insert title here <br>
<center>
<button type="submit" class="btn btn-primary ">发      送</button>
</center>
</form>
</center>
</div>
可能是由于时间格式不匹配所导致的问题
<%
Date date = new Date();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String str = df.format(date);
System.out.println(str);
%>
...
发送时间 
<input type="text" name="sendTime" value="<%=str%>">