hello I have a problem I get this error but I have checked and I don't know what it is?
<form:form method="get" commandName="dependenciascheckbox" class="form-horizontal">
<a class="text-left" action="eliminar_dependencia.htm" /> "><span class="icon"><i class="icon-trash"></i></span></a>
<c:forEach items="${depende}" var="dato">
<td>
<form:checkboxes items="true" path="isSelected" value="ON" />
</td>
<td>
<c:out value="${dato.idDependencias}" />
</td>
<td>
<c:out value="${dato.nomDependencia}" />
</td>
<td </td>
</c:forEach>
@RequestMapping(value = "eliminar_dependencia.htm", method = RequestMethod.GET)
public ModelAndView eliminar_dependencia( @ModelAttribute("dependenciascheckbox") Dependenciascheckbox d, BindingResult result, SessionStatus status, HttpServletRequest re, Model model ) throws IOException {
this.validardependependenciacheckbox.validate(d, result);
ModelAndView mav = new ModelAndView();
if (result.hasErrors()) {
if (d.getIsSelected().equals(mav) == true) {
new MetodosHql().eliminarDatos(Integer.parseInt(re.getParameter("id")), new Dependenciascheckbox(d.getIsSelected(), d.getIdDependencias()));
//System.err.println("id"+d.getIdDependencias()+"select"+d.getSelect());
mav.setViewName("redirect:/admin_roles.htm"); return mav;
}
}
return mav;
}
Possibly your problem comes from the fact that you are sending the form by
GET
.When you send it this way, what you're really doing is sending the data as parameters in the url, for example:
www.myurl.es/test?param1=value1
So in the Spring controller you should process it with
@RequestParam
.That said, that is not the correct way to submit the form, the correct way would be to do it by
POST
:<form:form method="POST" commandName="dependenciascheckbox" class="form-horizontal">
This way, the form data is sent in the request body and you can process it with
@ModelAttribute
in the controller.In this post you can learn a little more about the verb with which to send forms.