I have a VERY GOOD WAY to help you find out Spring MVC if you have Maven up and running.
IF SO: go to your command line (Cygwin), I use ...
- mvn archetype: generate
- He will ask for an "archetype number." For you ... type 16
- Enter the group ID, which is the main package.
- Enter the ID of the artifact that is your project name.
- SNAP-SHOT --- just press enter the same with the version.
- A package is the same as the name of your group. EX: com.spring
- Confirm this by typing the letter 'y' and press enter.
Follow all the steps above after they are in your workspace directory. Thus, it is created there. You can do "mvn eclipse: eclipse" to load it into Eclipse or you can just import it. I prefer the old-fashioned import of an existing project.
Everything will be โalreadyโ configured for you in terms of the entire configuration (based on Java) that suits you. It will also have all the Maven dependencies you need and in your pom.xml. You can add or take it if you want.
The fact is that you will already have a running project, and you can play with it from there. First I create all my projects like this, and erase what I donโt need, and add what I do, and then from there.
Good luck !!!
Anywho ... add this to your web.xml. This will help you in your answer. Check it out below:
<context-param> <param-name>contextClass</param-name> <param-value> org.springframework.web.context.support.AnnotationConfigWebApplicationContext </param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener>
source share