0% found this document useful (0 votes)
62 views23 pages

Web App Frameworks: Struts, Spring, JSF

1. Struts is an MVC framework that implements the controller aspect of MVC, while JSF is a component-based framework that contains all aspects of MVC - the model, view, and controller. 2. JSF uses reusable UI components and is event-driven, while Struts uses actions and is not component-based. 3. JSF has built-in features like validation, conversion, and navigation that must be manually implemented in Struts.

Uploaded by

isarita
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views23 pages

Web App Frameworks: Struts, Spring, JSF

1. Struts is an MVC framework that implements the controller aspect of MVC, while JSF is a component-based framework that contains all aspects of MVC - the model, view, and controller. 2. JSF uses reusable UI components and is event-driven, while Struts uses actions and is not component-based. 3. JSF has built-in features like validation, conversion, and navigation that must be manually implemented in Struts.

Uploaded by

isarita
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 23

Application Development

Framework

1
Web Application Framework
• Framework introduces an elegant architecture solution. It
automates all tedious task of application.

Why Framework?

– Reusability

– Scalability

– Security

2
Struts MVC
The Struts framework is used to develop MVC (Model View Controller)
based web applications

3
4
Struts2 Features

• Controller – FilterDispatcher
– which inspects each incoming request.
– Routes requests to the appropriate set of actions.

• Model – Action
– Internal state of the application.
– Encapsulation of business logic into a single unit of
work.
– Serves as a centre for data transfer.

• View – Result
– Translates the application state to a UI.
5
Struts2 Features
• Interceptor Stack
– Components that execute both before and after the
request processing.

• ValueStack and OGNL


– Storage area for all application domain data needed during
request processing.

– OGNL : A powerful expression language used to reference


and manipulate properties on the ValueStack.

6
7
Spring MVC
Spring offers an MVC structured framework, using
dependency-injection to integrate different technologies
together

Web HTTP Controller Model


JDBC RDBMS
Spring Business objects,
Browser (Oracle)
DispatcherServlet Hibernate beans

View
JSP/HTML

Objects managed by Spring IoC Container

8
What does Spring offer?

• Dependency Injection
– Also known as IoC (Inversion of Control)

• Aspect Oriented Programming

• Portable Service Abstractions


– The rest of spring

• ORM, DAO, Web MVC, etc.


9
Dependency Injection defined
• IoC injects needed dependencies into the object
instead
– Setters or Contructor

• Primary goal is reduction of dependencies in


code
– an excellent goal in any case
– This is the central part of Spring

10
IoC Container And Dependency Injection
Normal Way Using IoC
public class A public class A
{ Class B Class C {
B myB = new B(); B myB;
IOC
C myC = new C(); Container C myC;
}
Class A public setB(B myB)
public setC(C myC)

• Dependency Injection Styles

• Setter/getter based
• Constructor based

11
Aspect Oriented Programming
defined
• Attempts to separate concerns, increase
modularity, and decrease redundancy.

• Aspect: a modularization of a concern that cuts


across multiple classes.

– Cross-Cutting Concerns
(logging, transaction management, data validation)

12
Spring Modules

13
Struts vs Spring
Spring Struts

Spring implements IOC Design Pattern. Struts implement MVC Design Pattern.

Spring Framework is said to be a non-invasive means it Struts is said to be invasive. In Struts we used to extend
doesn’t force a programmer to extend or implement their Action Class.
class.

Spring provides easy integration with ORM, JDBC In Struts, integrating with ORM,
technologies. JDBC technology, we need to do manually coding.

Gives built-in middleware services like transaction, logging, Doesn’t give built-in middleware services.
connection pooling etc.

Spring is Lightweight framework. Struts is Heavyweight framework.

Spring is loosely coupled. Struts is tightly coupled.

Advantages of Spring Framework: Advantages of Struts Framework:

Transaction management Excellent support for Tag Library, which has wide industry
•Support for Messaging acceptance.
•Support and Integration with Other Frameworks (Eg: •Easy to integrate with other client side technologies.
Hibernate, Struts,. etc)

14
What is JSF?
• JSF stands for Java Server Faces. It is a server-side
Java framework for web development.

• a component oriented and event driven web framework


to build up web applications.

• In JSF, a component is a group of classes that together


provide a reusable piece of web-based user interface
code

• Facelets is an open source Web template system. It is a


default view handler technology for JSF

15
What is JSF?

16
JSF Component Model
• Covers a wide range components.
– Reusable , Customizable, State aware

• It also provides server-side validation, data conversion,


defining page navigation.

• Easy to plug in third party components.

• Easy to create custom components of your own.

17
JSF Component Tree
• Components are represented using a tree.
• <f:view>
<h:form id=“form1”>
<h:outputText id=“lbl_name” value=“Name”>
<h:inputText id=“txt_name” value=“NameValue”>
</h:form>
</f:view>

18
Event Handling

• Events are created based on the request


parameters.

• Each event is broadcasted to the related


listeners.

19
JSF Request LifeCycle

20
Thanks

21
Spring Boot

• Spring boot is a utility for setting up


applications quickly, offering to build
Spring powered applications

• auto-configuration, and the ability to


quickly create standalone web apps

22
JSF vs Struts

• Struts is an action framework


– Controller of the MVC pattern
• JSF is an event driven and component
oriented framework.
– JSF contains all the members of the MVC.
• Model : Managed Beans
• View : Components
• Controller : Faces Servlet

You might also like