forEach内部表单选择中的HDIV错误

时间:2015-04-17 09:16:10

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

我在尝试在HDIV中实现form:select时遇到了麻烦。 这是我在JSP中的代码,它呈现选择器和选项:

<form:form
	modelAttribute="staffPosition" 
	method="post"
	action="${contextPath}/project/assign/staff">
	<td>
		<form:select class="form-control" path="staffID">
			<c:forEach items="${staffList}" var="staff">
				<c:set var="staffName" value="${staff.prefix} ${staff.firstName} ${staff.middleName} ${staff.lastName} ${staff.suffix}"/>
				<form:option value="${staff.id}" label="${staffName}"/>
			</c:forEach>
		</form:select>
	</td>
	<td>
		&nbsp;
	</td>
	<td>
		<form:input placeholder="Example: Project Manager, Leader, etc..."
			type="text"
			class="form-control"
			path="position"/>
	</td>
	<td>
		&nbsp;
	</td>
	<td>
		<button class="btn btn-default btn-flat btn-sm">Assign</button>
	</td>
</form:form>

点击分配并启动操作后,请求将以Controller的正确ID到达form:option

public String assignStaff(
	@ModelAttribute(ATTR_STAFF_POSITION) StaffAssignmentBean staffAssignment) {

然而,当我检查控制台时,出现了错误: INVALID_CONFIDENTIAL_VALUE;/pmsys/project/assign/staff;staffID;27;[27, 28, 29, 30, 31, 32, 41];127.0.0.1;127.0.0.1;root

当我试图跟踪发出错误的代码行时: org.hdiv.filter.ValidatorHelperRequest:948

评估此条件时,originalValue和参数value不一致: if (!m.matches() || (Integer.valueOf(value).intValue() >= stateValues.size())) {

originalValue = [27,28,29,30,31,32,41]

value = 27(这是我在JSP中选择的form:option的ID号)

有没有人解决这个问题?这可能是HDIV中的一个错误吗?

注意: 如果<c:forEach内没有<form:select,则不会出现此问题。

更新 这是我的 hdiv配置

<!-- *********************************************************** -->
	<!-- *********************************************************** -->
	<!-- HDIV ****************************************************** -->
	<!-- *********************************************************** -->
	<!-- *********************************************************** -->
	<!-- HDIV Config -->
	<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="/"/>
		
		<!-- Controller calls that do not have validation -->
		<hdiv:startPages>/</hdiv:startPages>
		<hdiv:startPages method="get">/auth/denied,/fix,/,/auth/login,/auth/logout,/dashboard/,/image/display/project/profile/,/image/display/staff/profile/</hdiv:startPages>
		<hdiv:startPages method="post">/j_spring_security_check</hdiv:startPages>
	</hdiv:config>

WEB.xML

	<!-- Replace JSTL tld with HDIV tld-->
	<jsp-config>
	    <taglib>
	        <taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
	        <taglib-location>/WEB-INF/tlds/hdiv-c.tld</taglib-location>
	    </taglib>
	</jsp-config>
	
	<!-- HDIV Listener -->
	<listener>
	    <listener-class>org.hdiv.listener.InitListener</listener-class>
	</listener>
	
	<!-- HDIV Validator Filter -->
	<filter>
	    <filter-name>ValidatorFilter</filter-name>
	    <filter-class>org.hdiv.filter.ValidatorFilter</filter-class>
	</filter>
	<filter-mapping>
	    <filter-name>ValidatorFilter</filter-name>
	    <servlet-name>appServlet</servlet-name>
	</filter-mapping>

VERSIONS

<hdiv-version>2.1.9</hdiv-version>

<org.springframework>4.1.6.RELEASE</org.springframework>

0 个答案:

没有答案