0
My page is like this;
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org">
<body>
<h1>Olá! Thymeleaf configurado!</h1>
</body>
<form method="POST">
<label for="numero">numero</label>
<input type="text" id="numero" name="nomero"/>
<input type="submit" value="Salvar"/>
</form>
</html>
And my controller is like this;
package com.controle.boleto.controller;
import javax.validation.Valid;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.controle.boleto.model.Boleto;
@Controller
public class BoletoController {
@RequestMapping("/boleto/novo")
public String novo(){
return "boleto/CadastroBoleto";
}
@RequestMapping(value="/boleto/novo", method = RequestMethod.POST)
public String cadastrar(@Valid Boleto boleto, BindingResult result ){
if(result.hasErrors()){
System.out.println("tem erro sim");
}
System.out.println(">>>>> numero " + boleto.getNumero());
return "redirect:/boleto/novo";
}
}
my model is like this;
@NotBlank
private String numero;
private BigDecimal valor;
private String comentario;
public String getNumero() {
return numero;
}
public void setNumero(String numero) {
this.numero = numero;
}
public BigDecimal getValor() {
return valor;
}
public void setValor(BigDecimal valor) {
this.valor = valor;
}
public String getComentario() {
return comentario;
}
public void setComentario(String comentario) {
this.comentario = comentario;
}
The getNumer is returning null, is someone seeing something I’m not seeing?
thank you very much, I messed up badly.
– wladyband