1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| @Controller
public class ContactController {
@Autowired
ContactMetier services;
@RequestMapping(value="/index")
public String pageIndex(Model model){
model.addAttribute("listeContact", services.getAllContacts());
return "index";
}
@RequestMapping(value="/deleteContact")
public String suppContact(Model model, @RequestParam Long id){
services.deleteContact(id);
model.addAttribute("listeContact", services.getAllContacts());
return "index";
}
//update ne marche pas !!
@RequestMapping(value="/updateContact")
public String modifierContact(Model model, Contact c){
services.updateContact(c);
model.addAttribute("listeContact", services.getAllContacts());
return "index";
}
@RequestMapping(value="/addContact")
public String addProduct(Model model,Contact c){
services.addContact(c);
model.addAttribute("listeContact", services.getAllContacts());
return "index";
}
@RequestMapping(value="/rechercheContacts")
public String rechercheContacts(Model model, @RequestParam(value="type") String type){
List<Contact> liste= services.getContactsByType(type);
model.addAttribute("listeContact", liste);
model.addAttribute("type", type);
return "index";
}
} |
Partager