I'm having trouble trying to implement form:select
in HDIV. Here's my code in the JSP which renders the selector and options:
<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>
</td>
<td>
<form:input placeholder="Example: Project Manager, Leader, etc..."
type="text"
class="form-control"
path="position"/>
</td>
<td>
</td>
<td>
<button class="btn btn-default btn-flat btn-sm">Assign</button>
</td>
</form:form>
After I click assign and initiate the action, the request would arrive in the Controller
with the correct ID of the selected form:option
.
public String assignStaff(
@ModelAttribute(ATTR_STAFF_POSITION) StaffAssignmentBean staffAssignment) {
However, when I inspected the console, there was an error: 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
When I tried to trace the line of code which spits out the error: org.hdiv.filter.ValidatorHelperRequest:948
There was an inconsistency with the originalValue
and the parameter value
when this condition was evaluated: if (!m.matches() || (Integer.valueOf(value).intValue() >= stateValues.size())) {
originalValue
= [27, 28, 29, 30, 31, 32, 41]
value
= 27 (This is the ID number of the form:option
which I selected in the JSP)
Does anyone have any solution to this problem? Could this be a bug in HDIV?
Note: This problem does not occur if I do not have a <c:forEach
inside <form:select
.
UPDATE: This is my hdiv configuration:
<!-- *********************************************************** -->
<!-- *********************************************************** -->
<!-- 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>
The WEB.xML
<!-- Replace JSTL tld with HDIV tld-->
<jsp-config>
<taglib>
<taglib-uri>http://ift.tt/1vL9NML;
<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>
and VERSIONS
<hdiv-version>2.1.9</hdiv-version>
<org.springframework>4.1.6.RELEASE</org.springframework>
Aucun commentaire:
Enregistrer un commentaire