Good day!
I have a list of violations and form, where this violations are shown in drop down list. List "violation" has 2 attributes: violationDescription and idViolation. When I select one of violationDescription and press button Save I need to get it's idViolation and send it to controller. I need it to add a new violation to my table Post, which collect violations, dates and other information. How can I do that?
List<ViolationsEntity> violation = violationsDao.findAllByOrderByViolationDescriptionAsc();
model.addObject("violations", violation);
form.jsp
<form:select path="classificators">
<form:option value="NONE" label="--- Select violation---" />
<c:forEach items="${violations}" var="violation">
<form:option value="${violation.violationDescription}"/>
</c:forEach>
</form:select>