SlideShare a Scribd company logo
Web Component Development
with Servlet & JSP Technologies
(EE 6)
Module-3: Implementing an MVC Design
Team Emertxe
www.webstackacademy.com
Objectives
Upon completion of this module, you should be able
to:
● Implement the controller design using a Servlet
● Implement the model design using a POJO
● Implement the view design element using a JSP and
the expression language(EL)
● Connect the model view and controller element to
implement a working MVC solution
www.webstackacademy.com
Relevance
Discussion – The following questions are relevant to
understanding how to develop a controller component:
● How can you implement the controller?
● How can you implement the model?
● How can you implement the view?
www.webstackacademy.com
Forwarding From a
Servlet to a JSP
The mechanism used to invoke the JSP page is called
forwarding. Code to perform this is shown below.
RequestDispatcher rd =
request.getRequestDispatcher("view.jsp");
rd.forward(request, response);
www.webstackacademy.com
Passing Data From
the Servlet to JSP
ServletRequest.getAttribute(String key)
ServletRequest.setAttribute(String key, Object value)
So, if a controller servlet writes a data item into an attributed using
the following code:
request.setAttribute("aValue", 99);
Then the value can be read in a JSP page using this syntax:
${aValue}
www.webstackacademy.com
A Complete MVC
Example
To create a complete MVC, we need the following:
1. Controller class
2. The model class
3. JSP page
Web Stack Academy (P) Ltd
#83, Farah Towers,
1st floor,MG Road,
Bangalore – 560001
M: +91-80-4128 9576
T: +91-98862 69112
E: info@www.webstackacademy.com
www.webstackacademy.com

More Related Content

What's hot (12)

PPTX
Fun with ASP.NET MVC 3, MEF and NuGet (#comdaybe)
Maarten Balliauw
 
PPTX
How to Install Magento 2 on XAMPP Server localhost.
Web Visitors
 
PPTX
ASP.NET MVC From The Ground Up
Kevin Griffin
 
PPTX
Fun with ASP.NET MVC 3, MEF and NuGet
Maarten Balliauw
 
PPTX
ASP.NET Quick Wins - 20 Tips and Tricks To Shift Your Application into High Gear
Kevin Griffin
 
PPTX
Imagine recap-devhub
Magento Dev
 
PPT
Struts2 Course: Introduction
JavaEE Trainers
 
PPTX
Blogset
anithabannaravuri
 
PPTX
Scaffolding
DrMohamed Oaf
 
PPTX
Max Yekaterynenko: Magento 2 overview
Meet Magento Italy
 
PPTX
jQuery From the Ground Up
Kevin Griffin
 
PDF
Why you should consider a microframework for your next web project
Joaquín Muñoz M.
 
Fun with ASP.NET MVC 3, MEF and NuGet (#comdaybe)
Maarten Balliauw
 
How to Install Magento 2 on XAMPP Server localhost.
Web Visitors
 
ASP.NET MVC From The Ground Up
Kevin Griffin
 
Fun with ASP.NET MVC 3, MEF and NuGet
Maarten Balliauw
 
ASP.NET Quick Wins - 20 Tips and Tricks To Shift Your Application into High Gear
Kevin Griffin
 
Imagine recap-devhub
Magento Dev
 
Struts2 Course: Introduction
JavaEE Trainers
 
Scaffolding
DrMohamed Oaf
 
Max Yekaterynenko: Magento 2 overview
Meet Magento Italy
 
jQuery From the Ground Up
Kevin Griffin
 
Why you should consider a microframework for your next web project
Joaquín Muñoz M.
 

Similar to Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 3 - Implementing an MVC Design (20)

PDF
14 mvc
snopteck
 
PDF
My04_MVC.pdf
Alfas3
 
PDF
Mvc15 (1)
sloumaallagui1
 
PPTX
Advance java session 13
Smita B Kumar
 
PDF
Csajsp Chapter15
Adil Jafri
 
PDF
15 expression-language
snopteck
 
PDF
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 2...
WebStackAcademy
 
PPTX
Integrating Servlets and JSP (The MVC Architecture)
Amit Ranjan
 
PDF
JEE Programming - 05 JSP
Danairat Thanabodithammachari
 
PDF
Jsf2 overview
sohan1234
 
PDF
Ajax Basics 2
bhuvanann
 
PDF
005432796.pdf
EidTahir
 
PDF
Jsf2 overview
musaibasrar
 
PDF
J2EE_Course_Content
MV Solutions
 
POT
Beginning In J2EE
Suthat Rongraung
 
PPS
Struts Java I I Lecture 8
patinijava
 
PPT
Introduction to jsp
Jafar Nesargi
 
PPT
Introduction to jsp
Jafar Nesargi
 
14 mvc
snopteck
 
My04_MVC.pdf
Alfas3
 
Mvc15 (1)
sloumaallagui1
 
Advance java session 13
Smita B Kumar
 
Csajsp Chapter15
Adil Jafri
 
15 expression-language
snopteck
 
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 2...
WebStackAcademy
 
Integrating Servlets and JSP (The MVC Architecture)
Amit Ranjan
 
JEE Programming - 05 JSP
Danairat Thanabodithammachari
 
Jsf2 overview
sohan1234
 
Ajax Basics 2
bhuvanann
 
005432796.pdf
EidTahir
 
Jsf2 overview
musaibasrar
 
J2EE_Course_Content
MV Solutions
 
Beginning In J2EE
Suthat Rongraung
 
Struts Java I I Lecture 8
patinijava
 
Introduction to jsp
Jafar Nesargi
 
Introduction to jsp
Jafar Nesargi
 
Ad

More from WebStackAcademy (20)

PDF
Webstack Academy - Course Demo Webinar and Placement Journey
WebStackAcademy
 
PDF
WSA: Scaling Web Service to Handle Millions of Requests per Second
WebStackAcademy
 
PDF
WSA: Course Demo Webinar - Full Stack Developer Course
WebStackAcademy
 
PDF
Career Building in AI - Technologies, Trends and Opportunities
WebStackAcademy
 
PDF
Webstack Academy - Internship Kick Off
WebStackAcademy
 
PDF
Building Your Online Portfolio
WebStackAcademy
 
PDF
Front-End Developer's Career Roadmap
WebStackAcademy
 
PDF
Angular - Chapter 9 - Authentication and Authorization
WebStackAcademy
 
PDF
Angular - Chapter 7 - HTTP Services
WebStackAcademy
 
PDF
Angular - Chapter 6 - Firebase Integration
WebStackAcademy
 
PDF
Angular - Chapter 5 - Directives
WebStackAcademy
 
PDF
Angular - Chapter 4 - Data and Event Handling
WebStackAcademy
 
PDF
Angular - Chapter 3 - Components
WebStackAcademy
 
PDF
Angular - Chapter 2 - TypeScript Programming
WebStackAcademy
 
PDF
Angular - Chapter 1 - Introduction
WebStackAcademy
 
PDF
JavaScript - Chapter 10 - Strings and Arrays
WebStackAcademy
 
PDF
JavaScript - Chapter 15 - Debugging Techniques
WebStackAcademy
 
PDF
JavaScript - Chapter 14 - Form Handling
WebStackAcademy
 
PDF
JavaScript - Chapter 13 - Browser Object Model(BOM)
WebStackAcademy
 
PDF
JavaScript - Chapter 12 - Document Object Model
WebStackAcademy
 
Webstack Academy - Course Demo Webinar and Placement Journey
WebStackAcademy
 
WSA: Scaling Web Service to Handle Millions of Requests per Second
WebStackAcademy
 
WSA: Course Demo Webinar - Full Stack Developer Course
WebStackAcademy
 
Career Building in AI - Technologies, Trends and Opportunities
WebStackAcademy
 
Webstack Academy - Internship Kick Off
WebStackAcademy
 
Building Your Online Portfolio
WebStackAcademy
 
Front-End Developer's Career Roadmap
WebStackAcademy
 
Angular - Chapter 9 - Authentication and Authorization
WebStackAcademy
 
Angular - Chapter 7 - HTTP Services
WebStackAcademy
 
Angular - Chapter 6 - Firebase Integration
WebStackAcademy
 
Angular - Chapter 5 - Directives
WebStackAcademy
 
Angular - Chapter 4 - Data and Event Handling
WebStackAcademy
 
Angular - Chapter 3 - Components
WebStackAcademy
 
Angular - Chapter 2 - TypeScript Programming
WebStackAcademy
 
Angular - Chapter 1 - Introduction
WebStackAcademy
 
JavaScript - Chapter 10 - Strings and Arrays
WebStackAcademy
 
JavaScript - Chapter 15 - Debugging Techniques
WebStackAcademy
 
JavaScript - Chapter 14 - Form Handling
WebStackAcademy
 
JavaScript - Chapter 13 - Browser Object Model(BOM)
WebStackAcademy
 
JavaScript - Chapter 12 - Document Object Model
WebStackAcademy
 
Ad

Recently uploaded (20)

PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PPTX
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
PPT
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 

Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 3 - Implementing an MVC Design

  • 1. Web Component Development with Servlet & JSP Technologies (EE 6) Module-3: Implementing an MVC Design Team Emertxe
  • 2. www.webstackacademy.com Objectives Upon completion of this module, you should be able to: ● Implement the controller design using a Servlet ● Implement the model design using a POJO ● Implement the view design element using a JSP and the expression language(EL) ● Connect the model view and controller element to implement a working MVC solution
  • 3. www.webstackacademy.com Relevance Discussion – The following questions are relevant to understanding how to develop a controller component: ● How can you implement the controller? ● How can you implement the model? ● How can you implement the view?
  • 4. www.webstackacademy.com Forwarding From a Servlet to a JSP The mechanism used to invoke the JSP page is called forwarding. Code to perform this is shown below. RequestDispatcher rd = request.getRequestDispatcher("view.jsp"); rd.forward(request, response);
  • 5. www.webstackacademy.com Passing Data From the Servlet to JSP ServletRequest.getAttribute(String key) ServletRequest.setAttribute(String key, Object value) So, if a controller servlet writes a data item into an attributed using the following code: request.setAttribute("aValue", 99); Then the value can be read in a JSP page using this syntax: ${aValue}
  • 6. www.webstackacademy.com A Complete MVC Example To create a complete MVC, we need the following: 1. Controller class 2. The model class 3. JSP page
  • 7. Web Stack Academy (P) Ltd #83, Farah Towers, 1st floor,MG Road, Bangalore – 560001 M: +91-80-4128 9576 T: +91-98862 69112 E: [email protected] www.webstackacademy.com