Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove line breaks from method signatures
- Loading branch information
1 parent
7ff9e1a
commit 8bd3214
Showing
1 changed file
with
45 additions
and
49 deletions.
There are no files selected for viewing
94 changes: 45 additions & 49 deletions
94
src/main/java/heroku/template/controller/PersonController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,45 @@ | ||
package heroku.template.controller; | ||
|
||
import heroku.template.model.Person; | ||
import heroku.template.service.PersonService; | ||
|
||
import java.util.Map; | ||
|
||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.validation.BindingResult; | ||
import org.springframework.web.bind.annotation.ModelAttribute; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
|
||
@Controller | ||
public class PersonController { | ||
|
||
@Autowired | ||
private PersonService personService; | ||
|
||
@RequestMapping("/") | ||
public String listPeople(Map<String, Object> map) { | ||
|
||
map.put("person", new Person()); | ||
map.put("peopleList", personService.listPeople()); | ||
|
||
return "people"; | ||
} | ||
|
||
@RequestMapping(value = "/add", method = RequestMethod.POST) | ||
public String addPerson(@ModelAttribute("person") | ||
Person person, BindingResult result) { | ||
|
||
personService.addPerson(person); | ||
|
||
return "redirect:/people/"; | ||
} | ||
|
||
@RequestMapping("/delete/{personId}") | ||
public String deletePerson(@PathVariable("personId") | ||
Integer personId) { | ||
|
||
personService.removePerson(personId); | ||
|
||
return "redirect:/people/"; | ||
} | ||
} | ||
package heroku.template.controller; | ||
|
||
import heroku.template.model.Person; | ||
import heroku.template.service.PersonService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.validation.BindingResult; | ||
import org.springframework.web.bind.annotation.ModelAttribute; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
|
||
import java.util.Map; | ||
|
||
@Controller | ||
public class PersonController { | ||
|
||
@Autowired | ||
private PersonService personService; | ||
|
||
@RequestMapping("/") | ||
public String listPeople(Map<String, Object> map) { | ||
|
||
map.put("person", new Person()); | ||
map.put("peopleList", personService.listPeople()); | ||
|
||
return "people"; | ||
} | ||
|
||
@RequestMapping(value = "/add", method = RequestMethod.POST) | ||
public String addPerson(@ModelAttribute("person") Person person, BindingResult result) { | ||
|
||
personService.addPerson(person); | ||
|
||
return "redirect:/people/"; | ||
} | ||
|
||
@RequestMapping("/delete/{personId}") | ||
public String deletePerson(@PathVariable("personId") Integer personId) { | ||
|
||
personService.removePerson(personId); | ||
|
||
return "redirect:/people/"; | ||
} | ||
} |