This article is about “How to getting started with Spring MVC” using “Spring Template Project” on Spring Tool Suite eclipse based IDE (and Tomcat).
I assume you have already downloaded and installed your development tools and set up your development environment, then lets start.
- Open your Spring Tool Suite eclipse based IDE.
- File -> New->Spring Template Project (or File -> New->Other->Spring->Spring Template Project), then click Next.
- From “New Template Project” dialog select “Spring MVC Project”, then click Next.
- Fill Project name with “HelloWorld“
- Then Specify the top-level Package using “com.test.hello“, then click finish
- See in the “package explorer” in the left side of IDE, you will see “HelloWorld” as your project name, click it to expand the sub information.
- Right click on “WebApp” folder (under src/main) -> Build Path ->Use as Source Folder.
- Right Click on your project name “HelloWorld” -> Run As ->Run On Server
- Choose the server you want to use then click finish.
*if you got dependencies error message you should go to your project folder where the pom.xml placed then type command $mvn install <-this will download all needed dependencies if your IDE did not done that for you.
*if you get Tomcat 404 error follow this instruction link