samples/xml/contacts/src/main/java/sample/contact/AddDeleteContactController.java
@RequestMapping(value = "/secure/add.htm", method = RequestMethod.POST)
	public String addContact(WebContact form, BindingResult result) {
		validator.validate(form, result);

		if (result.hasErrors()) {
			return "add";
		}

		Contact contact = new Contact(form.getName(), form.getEmail());
		contactManager.create(contact);

		return "redirect:/secure/index.htm";
	}
@RequestMapping(value = "/secure/add.htm", method = RequestMethod.POST)
	public String addContact(WebContact form, BindingResult result) {
		validator.validate(form, result);

		if (result.hasErrors()) {
			return "add";
		}

		Contact contact = new Contact(form.getName(), form.getEmail());
		contactManager.create(contact);

		return "redirect:/secure/index.htm";
	}
@ RequestMapping ( value = "/secure/add.htm" , method = RequestMethod . POST ) public String addContact ( WebContact form , BindingResult result ) { validator . validate ( form , result ) ; if ( result . hasErrors ( ) ) { return "add" ; } Contact contact = new Contact ( form . getName ( ) , form . getEmail ( ) ) ; contactManager . create ( contact ) ; return "redirect:/secure/index.htm" ; }
Handles the submission of the contact form, creating a new instance if the username
and email are valid.
Handles the submission of the contact form creating a new instance if the username and email are valid .