পৃষ্ঠাসমূহ

.

Search Your Article

Total Pageviews

Showing posts with label Spring MVC Basics. Show all posts
Showing posts with label Spring MVC Basics. Show all posts

Tuesday, January 24, 2017

Spring - MVC Framework Overview

The Spring web MVC framework provides model-view-controller architecture and ready components that can be used to develop flexible and loosely coupled web applications. The MVC pattern results in separating the different aspects of the application (input logic, business logic, and UI logic), while providing a loose coupling between these elements.

Spring MVC - Environment Setup

This tutorial will guide you on how to prepare a development environment to start your work with Spring Framework. This tutorial will also teach you how to setup JDK, Tomcat and Eclipse on your machine before you setup Spring Framework:

Step 1 - Setup Java Development Kit (JDK):

You can download the latest version of SDK from Oracle's Java site: Java SE Downloads. You will find instructions for installing JDK in downloaded files, follow the given instructions to install and configure the setup. Finally set PATH and JAVA_HOME environment variables to refer to the directory that contains java and javac, typically java_install_dir/bin and java_install_dir respectively.
If you are running Windows and installed the JDK in C:\jdk1.6.0_15, you would have to put the following line in your C:\autoexec.bat file.
set PATH=C:\jdk1.6.0_15\bin;%PATH%
set JAVA_HOME=C:\jdk1.6.0_15
Alternatively, on Windows NT/2000/XP, you could also right-click on My Computer, select Properties, then Advanced, then Environment Variables. Then, you would update the PATH value and press the OK button.
On Unix (Solaris, Linux, etc.), if the SDK is installed in /usr/local/jdk1.6.0_15 and you use the C shell, you would put the following into your .cshrc file.
setenv PATH /usr/local/jdk1.6.0_15/bin:$PATH
setenv JAVA_HOME /usr/local/jdk1.6.0_15
Alternatively, if you use an Integrated Development Environment (IDE) like Borland JBuilder, Eclipse, IntelliJ IDEA, or Sun ONE Studio, compile and run a simple program to confirm that the IDE knows where you installed Java, otherwise do proper setup as given document of the IDE.

Step 2 - Install Apache Common Logging API:

You can download the latest version of Apache Commons Logging API from http://commons.apache.org/logging/. Once you downloaded the installation, unpack the binary distribution into a convenient location. For example in C:\commons-logging-1.1.1 on windows, or /usr/local/commons-logging-1.1.1 on Linux/Unix. This directory will have following jar files and other supporting documents etc.
Common Logging API Make sure you set your CLASSPATH variable on this directory properly otherwise you will face problem while running your application.

Step 3 - Setup Eclipse IDE

All the examples in this tutorial have been written using Eclipse IDE. So I would suggest you should have latest version of Eclipse installed on your machine.
To install Eclipse IDE, download the latest Eclipse binaries from http://www.eclipse.org/downloads/. Once you downloaded the installation, unpack the binary distribution into a convenient location. For example in C:\eclipse on windows, or /usr/local/eclipse on Linux/Unix and finally set PATH variable appropriately.
Eclipse can be started by executing the following commands on windows machine, or you can simply double click on eclipse.exe
 %C:\eclipse\eclipse.exe
Eclipse can be started by executing the following commands on Unix (Solaris, Linux, etc.) machine:
$/usr/local/eclipse/eclipse
After a successful startup, if everything is fine then it should display following result:
Eclipse Home page

Step 4 - Setup Spring Framework Libraries

Now if everything is fine, then you can proceed to setup your Spring framework. Following are the simple steps to download and install the framework on your machine.

Spring MVC - Hello World Example

The following example show how to write a simple web based Hello World application using Spring MVC framework. To start with it, let us have working Eclipse IDE in place and follow the following steps to develope a Dynamic Web Application using Spring Web Framework:

Spring MVC - Form Handling Example

The following example show how to write a simple web based application which makes use of HTML forms using Spring Web MVC framework. To start with it, let us have working Eclipse IDE in place and follow the following steps to develop a Dynamic Form based Web Application using Spring Web Framework:

Spring MVC - Page Redirection Example

The following example show how to write a simple web based application which makes use of redirect to transfer a http request to another another page. To start with it, let us have working Eclipse IDE in place and follow the following steps to develop a Dynamic Form based Web Application using Spring Web Framework:

Spring MVC - Static Pages Example

The following example show how to write a simple web based application using Spring MVC Framework, which can access static pages along with dynamic pages with the help of <mvc:resources> tag. To start with it, let us have working Eclipse IDE in place and follow the following steps to develop a Dynamic Form based Web Application using Spring Web Framework:

Spring MVC - Text Box Example

The following example show how to use Text boxes in forms using Spring Web MVC framework. To start with it, let us have working Eclipse IDE in place and follow the following steps to develop a Dynamic Form based Web Application using Spring Web Framework:

Spring MVC - Password Example

The following example show how to use Password in forms using Spring Web MVC framework. To start with it, let us have working Eclipse IDE in place and follow the following steps to develop a Dynamic Form based Web Application using Spring Web Framework:

Spring MVC - TextArea Example

The following example show how to use TextArea in forms using Spring Web MVC framework. To start with it, let us have working Eclipse IDE in place and follow the following steps to develop a Dynamic Form based Web Application using Spring Web Framework:

Spring MVC - Checkbox Example

The following example show how to use Single Checkbox in forms using Spring Web MVC framework. To start with it, let us have working Eclipse IDE in place and follow the following steps to develop a Dynamic Form based Web Application using Spring Web Framework:

Spring MVC - Checkboxes Example

The following example show how to use Multiple Checkboxes in forms using Spring Web MVC framework. To start with it, let us have working Eclipse IDE in place and follow the following steps to develop a Dynamic Form based Web Application using Spring Web Framework:

Spring MVC - RadioButton Example

The following example show how to use RadioButton in forms using Spring Web MVC framework. To start with it, let us have working Eclipse IDE in place and follow the following steps to develop a Dynamic Form based Web Application using Spring Web Framework:

Spring MVC - RadioButtons Example

The following example show how to use RadioButtons in forms using Spring Web MVC framework. To start with it, let us have working Eclipse IDE in place and follow the following steps to develop a Dynamic Form based Web Application using Spring Web Framework:

Spring MVC - Dropdown Example

The following example show how to use Dropdown in forms using Spring Web MVC framework. To start with it, let us have working Eclipse IDE in place and follow the following steps to develop a Dynamic Form based Web Application using Spring Web Framework:

Spring MVC - Listbox Example

The following example show how to use Listbox in forms using Spring Web MVC framework. To start with it, let us have working Eclipse IDE in place and follow the following steps to develop a Dynamic Form based Web Application using Spring Web Framework:

Spring MVC - Hidden Field Example

The following example show how to use Hidden field in forms using Spring Web MVC framework. To start with it, let us have working Eclipse IDE in place and follow the following steps to develop a Dynamic Form based Web Application using Spring Web Framework:

Spring MVC - Error Handling Example

The following example show how to use Error Handling and Validators in forms using Spring Web MVC framework. To start with it, let us have working Eclipse IDE in place and follow the following steps to develop a Dynamic Form based Web Application using Spring Web Framework:

Spring MVC - File Upload Example

The following example show how to use File Upload Control in forms using Spring Web MVC framework. To start with it, let us have working Eclipse IDE in place and follow the following steps to develop a Dynamic Form based Web Application using Spring Web Framework:

Spring MVC - Bean Name Url Handler Mapping Example

The following example show how to use Bean Name Url Handler Mapping using Spring Web MVC framework. BeanNameUrlHandlerMapping class is the default handler mapping class which maps URL request(s) to the name of the beans mentioned in the configuration.

Spring MVC - Controller Class Name Handler Mapping Example

The following example show how to use Controller Class Name Handler Mapping using Spring Web MVC framework. ControllerClassNameHandlerMapping class is the convention based handler mapping class which maps URL request(s) to the name of the controllers mentioned in the configuration.