In this session you will learn:
MVC
Spring MVC
Configuring web.xml
Creating Controller
Registering controller with dispatcher-servlet
Mapping requests to controller
Rendering response to View
For more information, visit: https://www.mindsmapped.com/courses/software-development/java-developer-training-for-beginners/
2. Page 2Classification: Restricted
Agenda
• MVC
• Spring MVC
• Configuring web.xml
• Creating Controller
• Registering controller with dispatcher-servlet
• Mapping requests to controller
• Rendering response to View
3. Page 3Classification: Restricted
MVC
• Model
• represents the business data
• View
• Web pages presented to the user
• Controller
• controls the flow of application
8. Page 8Classification: Restricted
Spring MVC
• open for extension closed for modification
• Pluggable View Technology: JSP, JSF, Velocity
• Injection of services into controller:
• removes code redundancy between business layer and presentation layer
• Integration with other components:
• integrates with other frameworks such as struts , hibernate, JSF
18. Page 18Classification: Restricted
Rendering response to View
• Declare a view resolver
• create a view to render the response
• View Resolver: maps the logical name to actual view
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver"
p:prefix="/WEB-INF/jsp/"
p:suffix=".jsp" />
19. Page 19Classification: Restricted
Rendering response to View
• Declare a view resolver
• create a view to render the response
• View Resolver: maps the logical name to actual view
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver"
p:prefix="/WEB-INF/jsp/"
p:suffix=".jsp" />