59

I am trying to follow the basic tutorial for Spring MVC but got lost at creating a new project in Eclipse.
It seems to me that most tutorials assume you know how to create a Spring Project in Eclipse.
Any advice on where to get started or tutorials which explain how to set up Eclipse would be appreciated.

Elysium
  • 145
  • 1
  • 4
  • 15
Rob
  • 593
  • 1
  • 5
  • 4

5 Answers5

51

You want to create a "Dynamic Web Project". Follow the steps here: Spring MVC Tutorial with Eclipse and Tomcat.

Also, here is the Eclipse documentation for Dynamic Web Projects: http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.wst.webtools.doc.user/topics/ccwebprj.html

danben
  • 80,905
  • 18
  • 123
  • 145
14

Download Spring STS (SpringSource Tool Suite) and choose Spring Template Project from the Dashboard. This is the easiest way to get a preconfigured spring mvc project, ready to go.

Sven Haiges
  • 2,636
  • 5
  • 42
  • 54
11

You don't necessarily have to create a Spring project. Almost all Java web applications have he same project structure. In almost every project I create, I automatically add these source folder:

  • src/main/java
  • src/main/resources
  • src/test/java
  • src/test/resources
  • src/main/webapp*

src/main/webapp isn't actually a source folder. The web.xml file under src/main/webapp/WEB-INF will allow you to run your java application on any Java enabled web server (Tomcat, Jetty, etc.). I typically add the Jetty Plugin to my POM (assuming you use Maven), and launch the web app in development using mvn clean jetty:run.

Community
  • 1
  • 1
Droo
  • 3,177
  • 4
  • 22
  • 26
  • 15
    I agree. Don't create a "Spring Project", and don't use SpringIDE. If you really want to learn Spring, create a dynamic web project, and then start loading in JARs, configs, etc., and learn Spring MVC from the ground up. –  Jul 11 '11 at 19:52
10

This is the easiest way :

step 1) install Spring Tool Suite (STS) for eclipse (version 3.7.0RELEASE or above) To do this you can go to Help >> eclipse market place , then type Spring Tool suite in search box.

step 2) now go to file >> new >> spring project as shown in the image below enter image description here

step 3)now choose the template as "spring MVC Project" and give a name to your project on the top as shown below ( I named it 'SpringProject') enter image description here

step 4)now give a base package name like this enter image description here

and that is . The project will be created in a few minutes and Now you can right click on it and run on server.

ishanbakshi
  • 1,915
  • 3
  • 19
  • 37
0
  1. step 1: create a new "Dynamic Web Project" in eclipse.
  2. step 2: right click on the created project.
  3. step 3: click on "configure" option.
  4. step 4: click on "convert to maven project".

here is more detailed information -> [1]: https://crunchify.com/simplest-spring-mvc-hello-world-example-tutorial-spring-model-view-controller-tips/