Reputation: 617
I managed to integrate HDIV and Spring MVC. Now HDIV generated security URLs for the static links. But when I tries to submit a link with a parameter, I always get error message. I know the reason is when the URL of a form is generated, the parameter is not a part of the URL. But I cannot find a workaround. Please help. Thanks a lot.
The form part is like this:
<c:url var="url" value="/contract/report/report" />
<form:form action="${url}" method="get">
<table >
<tr>
<td><label>Name:</label></td>
<td><select id="nameId" name="nameId">
<c:forEach var="c" items="${Users}">
<option value='${c.id}'> ${c.name}</option>
</c:forEach>
</select> </td>
<td><Button type="submit" >Submit</Button> </td>
</tr>
</table>
</form:form>
Update:
I found the workaround is I have to rewrite the select options with spring options like this:
<form:select path="contractId">
<c:forEach var="c" items="${Users}">
<form:option value="${c.id}" label="${c.name}"></form:option>
<c:forEach var="c" items="${Users}">
</form:select>
Thanks everyone.
Upvotes: 0
Views: 758
Reputation: 617
I found the workaround is I have to rewrite the select options with spring options like this:
<form:select path="contractId">
<c:forEach var="c" items="${Users}">
<form:option value="${c.id}" label="${c.name}"></form:option>
<c:forEach var="c" items="${Users}">
</form:select>
Thanks everyone.
Upvotes: 0
Reputation: 271
Don't use c:url
for forms, you don't need it:
<form:form action="${pageContext.servletContext.contextPath}/contract/report/report" method="get">
...
</form:form>
Upvotes: 0
Reputation: 1292
If you want to add a parameter to the URL then this might work.
<c:url var="url" value="/contract/report/report"><c:param name="parameter" value="value" /></c:url>
Upvotes: 1