Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/312.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 为什么我在html中输入的日期为空?_Java_Html_Mysql_Spring Boot - Fatal编程技术网

Java 为什么我在html中输入的日期为空?

Java 为什么我在html中输入的日期为空?,java,html,mysql,spring-boot,Java,Html,Mysql,Spring Boot,我试图让用户输入一个日期作为生日,然后将其存储到数据库(mysql)。 输入行的名称如下所示: <p style="position:relative; left:30px; top:30px;">Date of Birth: <input type="Date" max="2020-12-31" th:field="*{birth}" required></p&

我试图让用户输入一个日期作为生日,然后将其存储到数据库(mysql)。 输入行的名称如下所示:

    <p style="position:relative; left:30px; top:30px;">Date of Birth:
        <input type="Date" max="2020-12-31" th:field="*{birth}" required></p>
和默认的getter和setter

在mysql中,出生类型设置为日期

但我得到了一个错误: NOTNULL属性引用空值或瞬时值:com.cms.PROTOTYPE.user.Request.birth;嵌套异常为org.hibernate.PropertyValueException:notnull属性引用空值或暂时值:com.cms.PROTOTYPE.user.Request.birth

其他用户输入可以正确地存储在数据库中。如果我将nullable设置为true,则在列中得到null

    @Column(name="birth", nullable=false)
    @DateTimeFormat(pattern = "yyyy-mm-dd")
    private Date birth;