Neither BindingResult nor plain target object for bean name 'dependendenciascheckbox' available as request attribute

0

Hello I have a problem I get this error but I have reviewed and I do not 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; 

}
    
asked by Kevin Castaño 03.05.2017 в 18:15
source

1 answer

0

Possibly your problem comes from sending the form by GET .

When you send it in this way, what you are really doing is sending the data as parameters in the url, for example:

www.myurl.es/test?param1=value1

So in the Spring driver you should process it with @RequestParam .

That said, that is not the correct way to send the form, it would be correct to do it by POST :

<form:form method="POST" commandName="dependenciascheckbox" class="form-horizontal">

In this way, the form data is sent in the body of the request and you can process it with @ModelAttribute in the controller.

In this entry you can learn a little more about the verb with which to submit forms.

    
answered by 04.05.2017 / 18:47
source