[code] org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'personas' available as request attribute root cause
java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'personas' available as request attribute [/code]
Estoy lo estoy haciendo en netbeans 8.0.2, saludos.
Mi index.jsp
[code]
<c:url var="addAction" value="/personas/add" ></c:url>
<form:form action="${addAction}" commandName="personas" method="POST">
<table>
<tr>
<td>
<form:label path="nombre">
<spring:message text="NOMBRE"/>
</form:label>
</td>
</tr>
<tr>
<td>
" />
</td>
</tr>
</table>
</form:form>
[/code]
Mi controlador:
[code]
package com.proyectito.springmvc.controller;
import com.proyectito.springmvc.model.Personas;
import com.proyectito.springmvc.service.PersonasService;
import java.util.Map;
import org.springframework.stereotype.Controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.ui.ModelMap;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
@RequestMapping("/*")
public class PersonasController {
private PersonasService personaService;
@RequestMapping(value= "/personas/add", method = RequestMethod.POST)
public String addPerson(@ModelAttribute("personas") Personas p){
this.personaService.addPerson(p);
return "redirect:/index";
}
}
[/code]
Mi Error:
[code]
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'personas' available as request attribute
root cause
java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'personas' available as request attribute
[/code]
Estoy lo estoy haciendo en netbeans 8.0.2, saludos.