Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.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
Spring mvc springmvc和html输入_Spring Mvc - Fatal编程技术网

Spring mvc springmvc和html输入

Spring mvc springmvc和html输入,spring-mvc,Spring Mvc,在Spring3.1WebMVC表单中,我使用以下字段从datepicker获取日期,并在表单中定义为String。我得到了所有的值,但没有得到日期字段 第一次尝试 <form:input id="fromDate" class="mydate" path="fromDate" size="10" maxlength="10" /> <script type="text/javascript"> Spring.addDecoration(new S

在Spring3.1WebMVC表单中,我使用以下字段从datepicker获取日期,并在表单中定义为
String
。我得到了所有的值,但没有得到日期字段

第一次尝试

<form:input id="fromDate" class="mydate" path="fromDate" size="10" maxlength="10" />
    <script type="text/javascript">
        Spring.addDecoration(new Spring.ElementDecoration({elementId : 'fromDate', widgetType : 'dijit.form.DateTextBox', widgetAttrs : {promptMessage: 'Enter From Date', invalidMessage: 'Please enter valid From Date', required: false, constraints: {datePattern : 'dd/MM/yyyy', required : false}, datePattern : 'dd/MM/yyyy'}}));
    </script>
<input id="toDate" class="mydate" path="toDate" size="10" maxlength="10" />
    <spring:bind path="schemeQuantity.toDate">
        ${status.value}
    </spring:bind>
    <script type="text/javascript"> 

addDecoration(新的Spring.ElementDecoration({elementId:'fromDate',widgetType:'dijit.form.DateTextBox',widgetAttrs:{promptMessage:'Enter From Date',invalidMessage:'Please Enter valid From Date',必需:false},datePattern:'dd/MM/yyyy'});
第二次尝试

<form:input id="fromDate" class="mydate" path="fromDate" size="10" maxlength="10" />
    <script type="text/javascript">
        Spring.addDecoration(new Spring.ElementDecoration({elementId : 'fromDate', widgetType : 'dijit.form.DateTextBox', widgetAttrs : {promptMessage: 'Enter From Date', invalidMessage: 'Please enter valid From Date', required: false, constraints: {datePattern : 'dd/MM/yyyy', required : false}, datePattern : 'dd/MM/yyyy'}}));
    </script>
<input id="toDate" class="mydate" path="toDate" size="10" maxlength="10" />
    <spring:bind path="schemeQuantity.toDate">
        ${status.value}
    </spring:bind>
    <script type="text/javascript"> 

${status.value}

可以使用简单的HTML输入标记并与Spring MVC绑定。

可以使用简单的HTML输入标记。
在表单标记中添加一个
commandName
属性,如下所示

<form:form commandName="attribute" name="createForm" id="createForm" acceptCharset="UTF-8" method="post" action="create">

我无法理解createAttribute。是为请求提供服务的方法,或者是单独的方法create属性。它只是一个方法名..没有其他..:)@ModelAttribute(“schemeQuantity”)公共schemeQuantity getSchemeQuantity(){schemeQuantity schemeQuantity=new schemeQuantity();schemeQuantity.setQuantityRules(new AutoPopulationGlist(QuantityRule.class));/.setStudents(new AutoPopulationGlist(Student.class));返回schemeQuantity;}我也需要添加方法。告诉我一件事。您是在尝试从UI获取值,还是反过来?