send variable from html to controller spring boot

rono
Member
Inscription: 04 May 2017

send variable from html to controller spring boot

Post By rono » 04 May 2017, 10:07

does anyone knows how to send an attribute of an object(groupe.name) trough a form to controller, the form is for updating an image (image of the groupe) in the controller i should know the name of the groupe so as to update its image. hope u answer! thanks
Maxo
Member
Inscription: 06 May 2017

Re: send variable from html to controller spring boot

Post By Maxo » 06 May 2017, 22:38

Groupe class :
public class Groupe{
       private String name;
       
        //Getter and Setter
}
Controller : 
@RequestMapping(value = "URL_OF_POST",  method = ...)
public String postForm( ModelAttribute Groupe formGroupe ){
....
}

HTML 
<form>
       <input name="name" />
</form>
Nico.Fr
Member
Inscription: 12 May 2017

Re: send variable from html to controller spring boot

Post By Nico.Fr » 12 May 2017, 23:37

That works ?