带有参数的POST上的HDIV INVALID_CONFIDENTIAL_VALUE

时间:2015-04-15 05:37:14

标签: java spring spring-mvc spring-security hdiv

我的JSP中有以下代码:



<form:form id="detailsForm" modelAttribute="project" method="post" action="${contextPath}/project/create">

<form:input type="hidden" path="id" value="${project.id}"/>

<form:input type="text" class="form-control" path="name" value="${fn:escapeXml(project.name)}"/><br/>

<form:input type="text" class="form-control" path="location" value="${fn:escapeXml(project.location)}"/><br/>

<form:input type="text" class="form-control" path="notes" value="${fn:escapeXml(project.notes)}"/><br/>

<button class="btn btn-default btn-flat btn-sm">Update</button>

</form:form>
&#13;
&#13;
&#13;

这似乎不起作用。如果我单击Update按钮,控制台将记录错误INVALID_CONFIDENTIAL_VALUE

但是,一个也有POST方法的表单但是没有任何参数似乎工作:

&#13;
&#13;
<form:form action="${contextPath}/project/delete/${project.id}" method="post">

	<button class="btn btn-default btn-flat btn-sm">Delete This Project</button>

</form:form>
&#13;
&#13;
&#13;

我的表格可能有什么问题?

我有以下HDIV配置:

&#13;
&#13;
<beans:bean id="hdivEditableValidator" class="org.hdiv.web.validator.EditableParameterValidator"/>
<mvc:annotation-driven validator="hdivEditableValidator"/>

<!-- Accepted pattern within the application for all editable parameters (generated from textbox and textarea) -->
<hdiv:validation id="safeText">
	<hdiv:acceptedPattern><![CDATA[^[a-zA-Z0-9@.\-_]*$]]></hdiv:acceptedPattern>
</hdiv:validation>

<hdiv:editableValidations>
	<hdiv:validationRule url=".*" enableDefaults="false">safeText</hdiv:validationRule>
</hdiv:editableValidations>

<hdiv:config
		debugMode="true"
		errorPage="/fix"
		excludedExtensions="css,png,gif,jpeg,jpg,js,woff,woff2,map"
		randomName="true"
		strategy="cipher">
		<hdiv:sessionExpired loginPage="/auth/login" homePage="/"/>

		<hdiv:startPages>/</hdiv:startPages>
		<hdiv:startPages method="get">/auth/denied,/fix,/,/auth/login,/auth/logout,/dashboard/,/image/display/project/profile/,/pmsys/image/display/staff/profile/</hdiv:startPages>
		<hdiv:startPages method="post">/j_spring_security_check</hdiv:startPages>
	</hdiv:config>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

我通过在表单

中指定commandName来解决我的问题

&#13;
&#13;
<form:form id="detailsForm"
                  											commandName="project"
                  											method="post"
&#13;
&#13;
&#13;

将隐藏输入转换为:

&#13;
&#13;
<form:hidden path="id"/>
&#13;
&#13;
&#13;