Monday 25 April 2011

How to create and execute the first Spring Program.

Prerequisite:

    Java SDK 1.6 (Used during this tutorial)
    Eclipse Indigo (Can also be used Later versions)
    Spring Framework 3.1
    HSQLDB v2.2.8 (Any other DB can also be used)
  Spring Environment Set up

Application to be Developed :



Here in this tutorial we are developing an application where we will Insert(Create) User Details in System. Other CRUD operation look here.
Application Setup :
How to create a Project in Eclipse?

Create the Java Project
Give the project name: Project00
Finish


First create directory for Spring 3 MVC application. Open Eclipse and go to File >> New >> Other. Then select “Dynamic Web Project” from “Select a Wizard” screen.
or
In case of Eclipse Mars: you need do the following :



Now click “Next“. In next(New Dynamic Web Project) screen provide the name of the application as “JBTSpringMVC”



Add all required Jar in WebContent>WEB-INF>lib
 //You can download all Spring Frame Work JAR from here http://spring.io/projects/

Required JARs:

commons-loggins-1.1.1.jar
<database jar>
org.springframework.aop-3.1.1.RELEASE.jar
org.springframework.asm-3.1.1.RELEASE.jar
org.springframework.beans-3.1.1.RELEASE.jar
org.springframework.context-3.1.1.RELEASE.jar
org.springframework.core-3.1.1.RELEASE.jar
org.springframework.expression-3.1.1.RELEASE.jar
org.springframework.jdbc-3.1.1.RELEASE.jar
org.springframework.transaction-3.1.1.RELEASE.jar
org.springframework.web-3.1.1.RELEASE.jar
org.springframework.web.servlet-3.1.1.RELEASE.jar

Configure web.xml in 'WEB-INF' directory:

Now we should modify the web.xml file in JBTSpringMVC

Steps to modify web.xml