使用date时的http 400错误请求 - Spring MVC,pickadate.js

时间:2013-12-30 23:52:14

标签: spring http spring-mvc post

我有一个包含3个字段的简单表单,一个包含pickadate(),另一个包含pickatime(),最后一个是简单的数字。

当我尝试发布表单时,出现错误的请求错误。

请求dedails

Request URL:http://localhost:8080/CapTheater/admin/addProjection
Request Method:POST
Status Code:400 Mauvaise Requête

请求标题

Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/
Accept-Encoding:gzip,deflate,sdch
Accept-Language:fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4
Cache-Control:max-age=0
Connection:keep-alive
Content-Length:39
Content-Type:application/x-www-form-urlencoded
Cookie:JSESSIONID=EA0DDBF444BC5A4CA416715D72FF9D71
Host:localhost:8080
Origin:http://localhost:8080
Referer:http://localhost:8080/CapTheater/showMovie/1
User-Agent:Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36

表格数据

day:2014-01-01
date:09:30
place_nbr:0

响应标头

Connection:close
Content-Length:986
Content-Type:text/html;charset=utf-8
Date:Mon, 30 Dec 2013 23:35:24 GMT
Server:Apache-Coyote/1.1

以下是表单:

<form:form method="post" action="../admin/addProjection" id="add_movie_form">
    <form:label id="dayLabel" path="day">Date : </form:label>
    <form:input type="text" id="dayInput" path="day" />
    <form:label id="startLabel" path="date">Start : </form:label>
    <form:input type="text" id="startInput" path="date" />
    <form:label id="sizeLabel" path="place_nbr">Steats availables : 
    <form:input type="text" id="sizeInput" path="place_nbr" />
    <input type="submit" class="btn btn-primary"value="Save" />
</form:form>
<script type="text/javascript">
        $("#tabs").tabs();
        $("#dayInput").pickadate({
            format : 'yyyy-mm-dd',
            min : new Date()
        });
        $("#startInput").pickatime({
            format : 'HH:i',
            min: [8, 0],
            max: [22, 30]
        });
    </script>

控制器

@RequestMapping(value = "admin/addProjection", method = RequestMethod.POST)
public String addProjection(
@ModelAttribute("command") final Projection projection,
    final ModelMap model)
{
        projectionDao.save(projection);
        return "/showMovie/" + projection.getMovieId() + "#tabs-4";
}

最后,在bean中

public class Projection implements Comparable<Projection>
{
@DateTimeFormat(pattern = "yyyy-MM/dd")
    private Date day;
    public Date getDay()
    {
        return day;
    }

    public void setDay(Date day)
    {
        this.day = day;
    }
}

谢谢:)

0 个答案:

没有答案