Friday, February 3, 2017

Spring MVC eCommerce Website

Start demo spring project

1. Create New project with maven
# set project java sdk
2. Check Create from archetype
3. Group ID: HelloSpringsDemo
Artifact ID: HelloSpringsDemo
4. Project name: HelloSpringsDemo

Hit finish

* Import maven dependency

1# add dependency spring-webmvc 4.0.6.RELEASE
2# check spring plugin (setting>plugin)
3# create a folder call webapp>WEB-INF and create web.xml file
(Right click on project>Add frameworks support and check on Web Application and ok then copy web.xml in webapp>WEB-INF to webapp>WEB-INF)
4# Go to File>Project Structure and under Web reconfigure the path for deployment descriptor(web.xml)

5# add servelt and servlet mapping

6# Add dispatcher servlet (Right click on project>Add frameworks goto spring click on spring mvc
and remove auto generated lines in web.xml )

7# In despetcher servlet
* add context:component-scan
* add mvc: annotation-driven
* add view resolver define as bean
InternalResorceViewResolver.

8# put libraries into deployment folder.
9# configure tomcat.








No comments:

Post a Comment