In my application I wanted to use get mapping to redirect me to topicform.html file. I do not know why this specific situation is not working. In other mappings it works fine.
@Controller
@SessionAttributes("newTopic")
@RequestMapping("/forum")
public class TopicsController {
...
@GetMapping("topicform")
public String newTopic(Principal principal, Model model){
...
}
@GetMapping("topic/{id}")
public String showTopic(@PathVariable Long id, Model model){
...
}
...
}
Topicform is not working but when I want to redirect to the topic it works fine.
Intelij even not mapping me it.
Html files directory looks like this:
Try this:
@GetMapping("/topicform")
public String newTopic(Principal principal, Model model){
...
}
@GetMapping("/topic/{id}")
public String showTopic(@PathVariable Long id, Model model){
...
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.