ssm框架之时间类型转换

结合SSM框架整合时的查询,添加功能

查询页面:

<%@ page language="java"
isELIgnored="false"
 import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f" %>

 

  

添加页面:

<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f" %>

  birthday:

SSM控制类:

//添加
@RequestMapping("addStudent")
public String addStudent(Student stu,@DateTimeFormat(pattern="yyyy-MM-dd")Date birthday) {
try {
stu.setBirthday(birthday);
service.addStudent(stu);
return "redirect:/stucla/findAll";
} catch (Exception e) {
return "redirect:/stucla/selClass";
}

SSM的pojo类:

@DateTimeFormat(pattern = "yyyy-MM-dd")  
private Date birthday;

你可能感兴趣的:(框架理解,ssm框架理解,ssm)