0

3 つのパラメーターがある Spring Tag フォーム要素を使用しています。

<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[^[a-zA-Z0-9@.\-_]*$]]>  </hdiv:acceptedPattern>
</hdiv:validation>
<hdiv:editableValidations registerDefaults="true">
    <hdiv:validationRule url=".*" enableDefaults="true">safeText</hdiv:validationRule>
</hdiv:editableValidations>
</beans>

これらのパラメーターを検証から除外したくありません。これらのパラメーターが検証され、スキップされないように HDIV を構成する方法を知りたいです。よろしくお願いします!

4

2 に答える 2

1

フォーム フィールドを作成するには、Spring フォーム タグを使用する必要があります。

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

ゴッソン

于 2015-08-31T07:23:17.723 に答える