当日期格式是yyyy-MM或者yyyy-MM-dd,都可以通过对象传到后台但就是yyyy格式传不过去,最后的处理办法:

String currentTime = request.getParameter("currentTime");

这样就可以在后台接受。

作为前台查询条件,查询之后前台还要回显,我只这样处理的:

//其实前台只需要年,后面的月和日并不重要,只是为了能够让spring解析传到前台

SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
String currentTimea = currentTime.concat("-01-01");
Date currentT = dateFormat.parse(currentTimea);
log.setCurrentTime(currentT);
//下面为前台日期
<label>年份:</label>
<input >
value="<fmt:formatDate value="${log.currentTime}" pattern="yyyy"/>" onclick="WdatePicker({dateFmt:'yyyy',isShowClear:true});"/>

 

相关文章:

  • 2021-08-20
  • 2022-01-15
  • 2022-12-23
  • 2022-12-23
  • 2022-01-29
  • 2022-01-01
  • 2021-05-05
猜你喜欢
  • 2022-12-23
  • 2021-06-02
  • 2021-07-30
  • 2022-12-23
  • 2021-07-30
  • 2021-11-18
  • 2022-12-23
相关资源
相似解决方案