I have this method in the controller that redirects me to the page where the form is
@RequestMapping(value= "/views/consulta", method = RequestMethod.GET)
public String redireccionaConsultaPage(Locale locale, Model model) {
model.addAttribute("consultaForm", new Consulta());
return Constantes.CONSULTA_VISTA;
}
in the model addAtribute, I pass the object that I want to fill with the data of the form, but how do I pull that data from the object ?, I change it in the following way
@RequestMapping(value= "/views/consulta", method = RequestMethod.GET)
public String redireccionaConsultaPage(Consulta consul, Locale locale, Model model) {
model.addAttribute("consultaForm", consul);
system.out.println("prueba" +consul.getClavePago())
return Constantes.CONSULTA_VISTA;
}
What I want to do is that by filling out the form and clicking on the search button, I get those form values and see them in the console and I put a system to see if it painted a field of the form, but it takes it out, and that is when the page starts in automatic enters that method and puts it null, and not even put value to the input of the form, as I can do so that I will not take it later after starting the page, but until I put a value and click on search
this is my signature
<form: form id="consulta" modelAttribute="consultaForm">
<tr>
<td><label>CENTRO PAGO</label></td>
<td><form: input type="text" id="pago" path="nombrePago"/></td>
</tr>
<tr>
<td><label>DIRECC PAGO</label></td>
<td><form: input type="text" id="direccpago" path="direccPago"/></td>
<input type="submit" />
</tr>
</form>
what is inside of path, are the attributes that I have in my object What is the best way to obtain this data? I saw that it could be with RequestParam, I think but I do not know how to use it help