Formatvorlage des Untertitelmasters durch Klicken bearbeiten
Struts
Web Technologies – Struts – WS 2010/11
Felix Matenaar, Ivan GolodPatrick Schlebusch, Petru Nicolaescu
18.11.10 Web Technologies
History
Server-side for dynamic web pages and web applications:
Common Gateway Interface – CGI
Overloaded server
ISAPI and Apache DSO
ASP
Java
JavaServer Pages – JSP
Java servlets
Web Technologies1
18.11.10 Web Technologies
Motivation Model 1:
JSP handles all responsibilities:
Processing request
Validating data
Handling business logic
Generating response
Good for small projects
Disadvantage:
Page design is intermixed with business logic
Inadmissible for big projects
Web Technologies2
Web Technologies3 22.11.2010 Web Technologies
MVC
ViewModel
Controller
Model 2:
Separates display of content from business logic
Model-View-Controller Pattern
Invented in Smalltalk at Xerox
Model - behavior and data
View - renders the model
Controller – receives input and initiates a response
18.11.10 Web Technologies
What is Struts?
Framework for MVC in Java Web Applications
Components:
Extensible controller implementation Front controller
Own servlets realize actual functionality
Tag libraries for the JSPs HTML Forms
Internationalization
AJAX
Web Technologies4
18.11.10 Web Technologies
MVC In Struts
Web Technologies5
View
JSPTags
Model
Java Beans
Controller
ActionServlet
Actionstruts-config.xml
ActionForm
18.11.10 Web Technologies
Architecture & Request Life Cycle
Web Technologies6
Front Controller Action
Template(e.g. JSP)
Configuration
request
response Provided by Struts
Created by developer
Interceptor (Struts 2)
Tags
result
18.11.10 Web Technologies
Action; Action Form The Action class
execute() : ActionForward
ActionForward, associated with current request
Configuring the action classes
The ActionForm
Associated with html form
Respects JavaBean specification
Web Technologies7
18.11.10 Web Technologies
Configuration File: struts-config.xml
Available under “WebContent\WEB-INF”
ActionForm declaration
Action Mappings
General mapping
any request to a resource with .do extension will be taken by Struts’ ActionServlet
Web Technologies8
A whole bunch of frameworks
Web Technologies9
DjangoRuby on Rails
Zend
Solarphp
Typo3
Google Web Tookit
StrutsWeb2py
18.11.10
Criteria
Web Technologies10
performance
user feeling
infrastructure costs
security
availability
data loss → image loss
development speed
time to market
always offer latest technology
Not only the framework design but also the programming
Language influence the applicability
18.11.10
Cursory comparison
Web Technologies11
Criteria Struts Django Zend Rails
Language Java Python PHP Ruby
Typing Strict Duck Duck Duck
Concept MVC MVC MVC MVC
Performance ++ - - -
Security o + - - ++
18.11.10
Summary
Big projects should separate
business logic and presentation
Struts is an MVC framework
Java
Scalable
Controller -> Actions
View -> JSP
18.11.1012
The end
Thank you!
18.11.10
18.11.10 Web Technologies
Literature
http://struts.apache.orgFramework Download, Documentation, Tutorials, etc..
Ian Roughley - „Starting With Struts 2“(http://www.infoq.com/minibooks/starting-struts2)
James Holmes - „Struts: The Complete Reference“
http://www.javauc.com/java/727