Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Java
@Controller
public class tdlController  {
    @Autowired
    TdlService tdlService;

    @GetMapping(value = "dmno")
    public String homepage(Model model) throws RuntimeException {
       // model.addAttribute("list",tdlService.findAll());
        return "dmno";
    }
    @RequestMapping("GetData2")
    @ResponseBody
    public List<ListtodoEntity> findAll(){
        return tdlService.findAll();
    }
}

This is my Controller file in project.

What I have tried:

I searched and tried many ways. Please help me!
Posted
Updated 23-Aug-23 2:16am
v2
Comments
Mohibur Rashid 22-Aug-23 18:55pm    
what's in your dmno.html file?
Quang Le 2023 23-Aug-23 5:10am    
It's a html file

1 solution

The error relates to your view resolver configuration that is causing a loop in dispatching requests. Without seeing the complete configuration of your Spring Boot application and the context in which this controller is being used, it's a bit challenging to find the exact cause of the issue.

a Few things you can check -
1) Make sure that your view resolver configuration is correctly set up. You should have a 'ViewResolver' bean configured to resolve views to their respective templates. Make sure that your 'ViewResolver' is not causing a loop in resolving the view for the 'dmno' endpoint.
2) Your '@GetMapping(value = "dmno")' annotation specifies that requests to the 'dmno' URL should be handled by the homepage method. It is not clear what you intend to achieve with this method. If you are trying to return a view named 'dmno', you should make sure that the view resolver can properly resolve this view.
3) If you are trying to return a view named 'dmno', ensure that you have a corresponding view template (example 'dmno.html' for Thymeleaf) in your appropriate folder of your project's resources.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900