Basic SpringMvC controller not working

2019-09-04 02:14发布

问题:

I am trying to set up a basic MVC controller project. I have created a servlet and couple of jsp pages. I can deploy the project and access the jsp pages.

The problem starts when I try to use the LoginController. The error I am getting is 404 error. Please help.

I have attached a screenshot of my codes and project structure. I gut instinct is the dispatcher servlet is not working the way it suppose to (just a guess).

I have googled and fiddled with the code for the past 5 hours to no avail. This is my first time asking question on S/O enter image description hereso I apologies If this is not in the correct format.

回答1:

localhost:8084/springmvcDemo/login

change to

localhost:8084/springmvcDemo/spring-mvc/login

This link will help you