Spring Hello World Application

The tutorial given below describes you the way to make a spring web application that displays Hello World message on the Browser.

Spring Hello World Application

Hello World Example using Spring, The tutorial given below describes you the way to make a spring web
application that displays Hello World message on the Browser.

For that we have created a file called "applicationContext.xml",
which defines the bean name, their properties as well as their values.

Required fields:-

1)class name: A class name is the implementation of the bean class that
is described in the bean definition.2)bean behavioral configuration elements: Here we define the bean behavior
that is bean initialization, dependency checking mode, destruction
methods etc.3)constructor arguments and property values :-Defines the no of arguments
and the property values that are to be set in the newly created bean.

Note:- We have not defined any of these behavior
in our context file since we haven't created any of the bean to be used.

dispatcher-servlet. xml:-This is the file from
which the mapping from actions to controllers is done .We have used
ControllerClassNameHandlerMapping and
SimpleUrlHandlerMapping classes to do such mapping.
ControllerClassNameHandlerMapping
class generate URL path mappings from the class names of the Controller.SimpleUrlHandlerMapping
maps URLs to the request handler beans.

p:viewName="index"Â />:This is the ParameterizableViewController. With
the use of this controller we can view the index.p:suffix=".jsp"Â />:-This is InternalResourceViewResolver.
With
the use of this we can map this name to an actual jsp page.

redirect.jsp:-<%Â response.sendRedirect("index.htm");Â %>:-This is a
method of Interface HttpServletResponse that is used to sends a temporary redirect response to the client using the specified redirect location.

Ramagiripratap
June 16, 2011
Error in Above redirect page
rewrite index.htm as index.jsp bcoz we created the jsp rather than a html file

Naushad
December 1, 2011
About Spring to jsp
I am not able to understand that is there will be web.xml and if there is web.xml then what will be servlet class. If there is no servlet-name tag will be then what should I write?