I am newbie with Java Spring and making a very simple program with Spring.
I decided to put my web.xml, demo-config.servet.xml and some folders and xml files into one path to make it to be clear.
Then, I updated the HomeController.java file :
package DemoSpringMVC.Controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class HomeController {
@RequestMapping("/")
public String Index() {
return "user/index";
}
}
and I updated the demo-config-servlet.xml file
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.3.xsd">
<context:component-scan
base-package="DemoSpringMVC"></context:component-scan>
<bean >
<property name="prefix" value="/WEB-INF/views/"></property>
<property name="suffix" value=".jsp"></property>
</bean>
</beans>
The eclipse shows no error, so I thought that I have no error.
But when I ran my DemoSpringMVC, it show me that the link is inactive ? As you can see in this picture ?
Here is my code, if you need to reference
https://github.com/nguyencuc2586/Spring3.1
Could you please give me some advices ? Thank you in advance.
CodePudding user response:
The code is ok. maybe It may be your tomcat configuration problem
CodePudding user response:
As per your code you are using servlet API 4.0 which needs Tomcat 9.0 and you mentioned that you are using Tomcat 10, so try using the Tomcat 9.0 version.