Documente Academic
Documente Profesional
Documente Cultură
Objectives
Understand the need for Struts
Identify the components of Struts framework
Web Container
JSP
Providing
Presentation,
Database
Flow Control
And
Business Logic
Model 2 –
MVC Architecture
Key Features
• Application flow is mediated
by a central Controller
• Controller acts as a single entry
point
• Controller interacts with Model
• Controller delegates requests and
forwards to target views
• Reusability, extensibility, modularity
and easy maintainability
Proposed Solution:
Design a simple application based on our existing knowledge on JSP and
servlets using Struts Framework.
Action
Action Servlet 2 dispatch [Model]
1 event
[Controller]
HTTP Request
1.2 create 2.1 (can) use
Action Form
Client
Browser
JSP
[View] 3.1 (can) interact Business Layer
4 update [Model]
HTTP Response
Additional Components:
Action Messages
Resource Bundle
web.xml
Action
1 event Action Servlet 2 dispatch
[Controller]
HTTP Request
1.2 create 2.1 (can) use
Action Form
Client
Browser
JSP
[View] 3.1 (can) interact Business Layer
4 update [Model]
HTTP Response
Action
1 event Action Servlet 2 dispatch [Model]
[Controller]
HTTP Request
1.2 create 2.1 (can) use
Action Form
Client
Browser
2.4 use 2.3 create
3 forward Action Forward 2.2 interact
JSP
[View] 3.1 (can) interact Business Layer
4 update [Model]
HTTP Response
Action
1 event Action Servlet 2 dispatch [Model]
[Controller]
HTTP Request
1.2 create 2.1 (can) use
Action Form
Client
Browser
JSP
[View] 3.1 (can) interact Business Layer
4 update [Model]
HTTP Response
Action
1 event Action Servlet 2 dispatch [Model]
[Controller]
HTTP Request
1.2 create 2.1 (can) use
Action Form
Client
Browser
JSP
[View] 3.1 (can) interact Business Layer
4 update [Model]
HTTP Response
Action
1 event Action Servlet 2 dispatch [Model]
[Controller]
HTTP Request
1.2 create 2.1 (can) use
Action Form
Client
Browser
2.4 use 2.3 create
3 forward Action Forward 2.2 interact
JSP
[View] 3.1 (can) interact Business Layer
4 update [Model]
HTTP Response
Action
1 event Action Servlet 2 dispatch [Model]
[Controller]
HTTP Request
1.2 create 2.1 (can) use
Action Form
Client
Browser
JSP
[View] 3.1 (can) interact Business Layer
4 update [Model]
HTTP Response
Action
1 event Action Servlet 2 dispatch [Model]
[Controller]
HTTP Request
1.2 create 2.1 (can) use
Action Form
Client
Browser
2.2 interact
2.4 use 2.3 create
3 forward Action Forward
JSP
[View] 3.1 (can) interact Business Layer
4 update [Model]
HTTP Response
Automatic validation
Using Validation framework
Handles many common cases
Validation messages