spring web



Share on Google+Share on Google+

spring web
1 Answer(s)      5 years and 7 months ago
Posted in : Spring

Hi can you explain the flow of spring web programatically.........

View Answers

October 18, 2011 at 12:42 PM

Hi at first please insert the all the relevant jar files in WEB-INF/lib directory, add the following servlet configuration in your web.xml file.


Now write the dispatcher-servlet.xml file and put it into the same directory as web.xml file.

In dispatcher servlet the main thing you have to do is to specify the path of the Controller class, as

<context:component-scan base-package="net.roseindia.controller" />

the following are the typical configurations in dispatcher-servlet.xml file

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"

    <!-- Enable annotation driven controllers, validation etc... -->
    <mvc:annotation-driven />
    <context:component-scan base-package="net.roseindia.controller" />

    <bean id="viewResolver"
        <property name="prefix">
        <property name="suffix">
    <bean id="multipartResolver"

Then write the form as

<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<h2>Please Enter Login Detail</h2>
<form:form action="loginForm.htm" commandName="loginForm">
    <table cellpadding="5" cellspacing="10" bgcolor="#00B8E6">
            <td><form:label path="userId">User Id</form:label></td>
            <td><form:input path="userId" /></td>
            <td><form:label path="password">Password</form:label></td>
            <td><form:password path="password" /></td>
            <td colspan="2" align="center"><input type="submit" value="Submit" /></td>


and corresponding bean class would be

package net.roseindia.model;

public class LoginForm {

    private String userId;
    private String password;

    public String getUserId() {
        return userId;

    public void setUserId(String userId) {
        this.userId = userId;

    public String getPassword() {
        return password;

    public void setPassword(String password) {
        this.password = password;

And Now you need the write the controller class. The package wold be the same as you specified in the dispatcher-servlet.xml file i.e net.roseindia.controller

The controller class is given below please consider it..

package net.roseindia.controller;

import javax.validation.Valid;

import net.roseindia.model.LoginForm;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

public class MyController {

    @RequestMapping(method = RequestMethod.GET)
    public String getRequest(ModelMap model) {
        LoginForm login = new LoginForm();
        model.put("loginForm", login);
        return "loginForm";

    // @RequestMapping("loginForm.htm")
    @RequestMapping(method = RequestMethod.POST)
    public String postReQuest(ModelMap model, @Valid LoginForm login) {
        // LoginForm login = new LoginForm();
        System.out.println("Id- " + login.getUserId());
        System.out.println("Id- " + login.getPassword());
        model.put("loginForm", login);
        return "loginForm";



Related Tutorials/Questions & Answers:
spring Web Services - Spring
spring Web Services  Hi, Can any one explains or give me some example which gives me that how to start up spring web services. Thanks, mahi
spring web - Spring
spring web  hi thanku for reply :) Actually i dint get u what is meaning of spring web as i understand i am telling you. I am using eclipse and jar files like spring.jar,tlds of spring. hibernet.jar and also required jars
Spring web service - Spring
Spring web service   Respected service, I have found an error in this manner(Connecting to tomcat then coming this error at first time only) and then working correctly. error coming only at first time. What
spring web
spring web  Hi can you explain the flow of spring web programatically... in WEB-INF/lib directory, add the following servlet configuration in your web.xml... http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http
Spring Web, Spring Web Modules, Spring Web Example
Spring Web In this section we will discuss about the modules of Spring Web layer. The Spring Web modules allows the developers to develop/manage web... easier. The Spring Web Layer contains following modules: Web
Web application - Spring
Web application  I need one simple complete web application example using springs with database connection,i saw ur demo but it is not succfient.can u send to [email protected] am a beginner
Spring web UrlBasedViewResolver
Spring web UrlBasedViewResolver...;org.springframework.web.servlet.view.JstlView" /> <property name="prefix"> <value>/WEB...://www.springframework.org/schema/beans/spring-beans-3.0.xsd http
How to make web appliction using spring and hibernate - Spring
How to make web appliction using spring and hibernate  Hi Actually i want to make an web application using spring as front end and hibernate as back...  Hello,Are you using Spring web for developing the application
Maven dependency for Spring Web MVC 4.0.1.RELEASE
Maven dependency for Spring Web MVC 4.0.1.RELEASE  Hi, What is the Maven dependency for Spring Web MVC 4.0.1.RELEASE? Thanks   Hi, You...; <groupId>org.springframework</groupId> <artifactId>spring
Spring web mvc 3.0 mysql project
Spring web mvc 3.0 mysql project  Hello Sir... I want a complete database connectivity web project in spring mvc 3.0..Just give me a simple example...: http://www.roseindia.net/spring/jdbc-template-batch-update.shtml
develope a web site using JSF,Spring,Hibernate.
develope a web site using JSF,Spring,Hibernate.  I have to develope a web site,just like Facebook,which will have all the functionality as wall post...,Spring Framework,Hibernate,JMS. Please anyone provide me idea,how to proceed ahead
Getting HTTP 404 error in Spring web MVC with Hibernate Integration
Getting HTTP 404 error in Spring web MVC with Hibernate Integration   Hi, i am Getting HTTP 404 error in Spring web MVC with Hibernate Integration...;Please visit the following links: http://www.roseindia.net/struts/hibernate-spring
Spring Architecture
for object-relational mapping APIs, including JDO, Hibernate and iBatis. Spring Web: is part of web application development stack. Spring DAO:- (Data Access Object... a consistent API. Spring Web MVC: provides the MVC implementations for the web
Spring Web Annotation Classes
Spring Web Annotation Annotation is introduced since java 5. It is a new kind... and it is not a part of your program. Spring framework also provides a wide range of annotation, some of them which is commonly is used in Spring MVC is explained
How to make Spring web Login form?
Developing Login Form in Spring Web - Create form for user to input login... based application in Spring Web  and validate the form using...: How to make Login Form in Spring MVC? To make the Spring Login form we have
Hibernate and Spring
and Spring for developing web applications. Read how you can integration Hibernate and Spring in web application at Developing Struts, Hibernate and Spring based... can integrate Hibernate, MVC framework (Struts/Spring Web), Transaction managers
BeanNameUrlHandlerMapping example in Spring 2.5 Web MVC framework
;    BeanNameUrlHandlerMapping example in Spring 2.5 MVC framework... is. The HandlerMapping we can map incoming web request to the appropriate handler. When the user...; how to use BeanNameUrlHandlerMapping in your application. Spring provides
how many scenarios is having to developing web based application by using spring mvc.
how many scenarios is having to developing web based application by using spring mvc.  hello everyone, I want to know how many scenarios are available to developing web based application using spring. i know simple form
spring   hi how can we make spring bean as prototype how can we load applicationcontext in spring what is dependency injection
spring  Access JSP files in Spring
spring  javascript browse image in spring progrme
spring  how to upgrade from struts2 to spring
How to make Simple form in Spring web?
" /> Finally we have to load the Spring Context on the web application... will learn how to create Spring web Login form? Download source code...Web application uses the HTML standard to make the form which runs in browser
spring - Spring
spring  what is the use of spring  Hi Friend, Spring is grate framework for development of Enterprise grade applications. Spring.... Spring can be used to configure declarative transaction management, remote access
spring  sir how to access multiple jsp's in spring
spring   i am a beginner in java.. but i have to learn spring framework.. i know the core java concepts with some J2EE knowledge..can i learn spring without knowing anything about struts
Spring  What is AOP concept in spring? How AOP concept differ from DI concept
spring  sir can you explain me the flow of sample example by using spring? thanks
a complete project on spring web mvc using oracle database in netbeans ide 7.0
a complete project on spring web mvc using oracle database in netbeans ide 7.0  dear sir , i want a complete tutorial on the title matter.please sir help me . any full developped project based on shopping cart can
spring   package bean; public interface AccountsDAOI{ double... normally. i set the classpath=D:\java softwares\ST-IV\Spring\spring-framework-2 .5.1\dist\spring.jar;D:\java softwares\ST-IV\Spring\spring-framework-2.5.1\lib\c
the following links: http://www.roseindia.net/spring/ http://www.roseindia.net/spring
Java Spring Hibernate Struts Training Spring bean annotation example Spring 5 Framework maven pom.xml java.lang.NoClassDefFoundError: org/springframework/transaction/interceptor/TransactionInterceptor Spring boot java.lang.NoClassDefFoundError: org/springframework/orm/jpa/support/PersistenceAnnotationBeanPostProcessor How to validate form using Spring MVC? Spring Framework Tutorials 2017 Is Spring Framework dead? spring inteview question You Spring Project is not running java lang incompatibleclasschangeerror quartz spring - Error resolved exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'transactionManager' is defined The import javax.validation cannot be resolved java.lang.NoSuchMethodError: javax.persistence.spi.PersistenceUnitInfo.getSharedCacheMode()Ljavax/persistence/SharedCacheMode java.lang.NoClassDefFoundError: org/hibernate/ejb/HibernatePersistence Solving java.lang.ClassNotFoundException: org.springframework.orm.hibernate4.LocalSessionFactoryBean issue What is the maven dependency for spring batch? Hibernate Session Attribute java.lang.ClassNotFoundException: org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean nested exception is java.lang.ClassNotFoundException: org.springframework.jdbc.datasource.DriverManagerDataSource Testing spring with junit and mock testing in Spring MVC, i would like to download my Mysql database table in pdf,msword,excel formats. java.lang.NoClassDefFoundError: org/hibernate/engine/FilterDefinition error package org.springframework.scheduling.quartz does not exist jquery dependency dropdown box in spring hibernate my sql Server side validation on dynamically generated fields from more than one table on spring framework. What are the new features of Spring 4.1? Append Arguments to the URL quartz schedular in spring mvc Where to download spring framework zip file? Integrating spring 4 with hibernate 4 Learn spring Multiple files upload code using spring mvc 2.0 with xml configuration without using annotations Spring 4 features I need Spring 2.5 example. Please point me towards a good Spring transactional tutorial Could anyone point me towards some good Spring tutorials, Please? What is Spring framework? Spring and hibernate based Online Shopping project with source code How to populate collection like map with annotation in mybatis? Spring Abstraction with Redis Spring framework How to insert and retreive an image in mysql database using spring mvc framework??? CRUD operations in spring mvc 2.5 meenakshi Meenakshi how many scenarios is having to developing web based application by using spring mvc. getting voucherPin parent and child dropdown Spring 3


Advertisement null