2015-08-30 42 views
0

我正在使用Spring Tag表單元素,其中有3個參數。HDIV INVALID_PARAMETER_NAME error with Spring Tag form

<sf:form class="form-horizontal" method="post" name="doCheck" id="checkForm" action="${url}" htmlEscape="true"> 
<div class="col-sm-12"> 
         <label>Email : <span class="redStar">*</span></label> 
         <input type="email" name="email" class="form-control user inputIconPos" id="inputEmail3" 
          placeholder="Email Address"/> 
        </div> 
       </div> 
//2 more fields 
</sf:form> 

我使用Spring MVC的版本4.1.7和HDIV版本2.1.11 。並記錄錯誤是

21:08:40.386 [http-bio-8100-exec-4] INFO org.hdiv.logs.Logger - INVALID_PARAMETER_NAME;/check_submit.html;email;null;;0:0:0:0:0:0:0:1;0:0:0:0:0:0:0:1;anonymous; 
21:08:40.386 [http-bio-8100-exec-4] DEBUG o.hdiv.filter.ValidatorHelperRequest - Validation Error Detected: Parameter [email] does not exist in the state for action [/check_submit.html] 

HDIV配置

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:hdiv="http://www.hdiv.org/schema/hdiv" 
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd 
http://www.hdiv.org/schema/hdiv http://www.hdiv.org/schema/hdiv/hdiv.xsd"> 
<hdiv:config excludedExtensions="css,png,gif,jpg,jpeg,bmp,ico,js" strategy="cipher" randomName="true" errorPage="/error.html" reuseExistingPageInAjaxRequest="true"> 
    <hdiv:sessionExpired loginPage="/login.html" homePage="/home.html"/> 
    <hdiv:startPages>/adminlogin.html,/home.html</hdiv:startPages> 
</hdiv:config> 
<hdiv:validation id="safeText"> 
    <hdiv:acceptedPattern><![CDATA[^[[email protected]\-_]*$]]> </hdiv:acceptedPattern> 
</hdiv:validation> 
<hdiv:editableValidations registerDefaults="true"> 
    <hdiv:validationRule url=".*" enableDefaults="true">safeText</hdiv:validationRule> 
</hdiv:editableValidations> 
</beans> 

我不想從驗證中排除這些參數。 我想知道如何配置HDIV,以便驗證這些參數並且不會跳過。 非常感謝提前!

+0

你能證明你的整個HDIV配置? – smoggers

+0

Hi @smoggers - 完成在編輯 –

回答

1

你必須使用Spring表單標籤來創建表單字段:

<form:input path="email" type="email" ... /> 

Gotzon

+0

中添加hdiv配置嘗試通過在form中使用form:input元素和Controller中的@ModelAttribute提供命令屬性。我仍然收到同樣的錯誤。 –