Changeset 5f53114 for Prototype Application/Paw5/src/main/java/finki
- Timestamp:
- 03/05/23 17:35:54 (16 months ago)
- Branches:
- main
- Children:
- 8b7dd7f
- Parents:
- 9358bff
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Prototype Application/Paw5/src/main/java/finki/paw5/web/controllers/PostController.java
r9358bff r5f53114 77 77 78 78 @GetMapping("/adoption-posts") 79 public String getAdoptionPosts(Model model , HttpServletRequest request){79 public String getAdoptionPosts(Model model){ 80 80 81 81 List<Post> posts = this.postService.findAll(); 82 82 List<Pet> pets = this.petService.listpets(); 83 //model.addAttribute("posts", posts); 84 //model.addAttribute("pets",pets); 85 request.getSession().setAttribute("posts",posts);//temp 86 request.getSession().setAttribute("pets",pets);//temp 83 model.addAttribute("posts", posts); 84 model.addAttribute("pets",pets); 87 85 88 86 return "list-posts-adoption"; … … 90 88 91 89 @GetMapping("/pet-details-{id}") 92 public String getPostDetails(@PathVariable Integer id, Model model, HttpServletRequest request){ 90 public String getPostDetails(@PathVariable Integer id, 91 Model model){ 93 92 94 93 Post post = this.postService.findById(id).get(); 95 94 Pet pet = this.petService.findById(post.getPetId()); 96 95 97 //model.addAttribute("pet", pet); 98 //model.addAttribute("post", post); 99 request.getSession().setAttribute("post", post);//temp 100 request.getSession().setAttribute("pet", pet);//temp 101 102 if(pet.getAdoptionId() != null){ 103 request.getSession().setAttribute("disableAdoption", true); 104 } else{ 105 request.getSession().setAttribute("disableAdoption", false); 106 } 96 model.addAttribute("pet", pet); 97 model.addAttribute("post", post); 107 98 108 99 return "pet-details";
Note:
See TracChangeset
for help on using the changeset viewer.