Lecture 2 - Struts ENTERPRISE JAVA. 2 Contents  Servlet Deployment  Servlet Filters  Model View Controllers  Struts  Dependency Injection.

Slides:



Advertisements
Similar presentations
JSP and Servelets.
Advertisements

JSP and web applications
Web Development with Karsten Schulz Terp-Nielsen Master Principal Sales Consultant Oracle Denmark.
Apache Struts Technology
Servlets Enterprise Systems Programming. Servlets  Servlets: server-side Java programs that enable dynamic processing of web-based requests  Web-based.
Object-Oriented Enterprise Application Development Tomcat 3.2 Configuration Last Updated: 03/30/2001.
WEB1P servintro1 Introduction to servlets and JSP Dr Jim Briggs.
27-Jun-15 Directories and DDs. 2 Web apps A web application is basically a web site that: “Knows who you are”--it doesn’t just give you static pages,
Java Server Pages Russell Beale. What are Java Server Pages? Separates content from presentation Good to use when lots of HTML to be presented to user,
14-Jul-15 Tomcat. 2 The Apache Jakarta Project The Apache Jakarta Project “creates and maintains open source solutions on the Java platform for distribution.
Apache Struts Technology A MVC Framework for Java Web Applications.
TimeTracker 2, Take 1  Servlets Web Interface (jsp) Servlet (business logic and processing) App Engine Datastore Form Submit R/W.
Session-01. Layers Struts 2 Framework The struts 2 framework is used to develop MVC-based web application. Struts 1.0 was released in June The.
Server Side Programming Web Information Systems 2012.
Java Servlets and JSP.
Introduction to Java web programming Dr Jim Briggs JWP intro1.
Gayle J Yaverbaum, PhD Professor of Information Systems Penn State Harrisburg.
Struts 2.0 an Overview ( )
Introduction to Struts 2.0 Jenny Ni Joey Feng Winddays Wang Hewmmi Zhu Heather Lv Software School,Fudan University 1.
UNIT-V The MVC architecture and Struts Framework.
CSCI 6962: Server-side Design and Programming Course Introduction and Overview.
Copyright © 2012 Accenture All Rights Reserved.Copyright © 2012 Accenture All Rights Reserved. Accenture, its logo, and High Performance Delivered are.
AN OVERVIEW OF SERVLET TECHNOLOGY SERVER SETUP AND CONFIGURATION WEB APPLICATION STRUCTURE BASIC SERVLET EXAMPLE Java Servlets - Compiled By Nitin Pai.
Design Patterns Phil Smith 28 th November Design Patterns There are many ways to produce content via Servlets and JSPs Understanding the good, the.
Chapter 5 Java Servlets. Objectives Explain the nature of a servlet and its operation Use the appropriate servlet methods in a web application Code the.
Java Servlets and Java Server Pages Carol Wolf Computer Science.
SKT-SSU IT Training Center Servlet and JSP. Chapter Three: Servlet Basics.
Basic Struts Architecture Client Server Database Request Response Control View Model Server Struts Framework.
© 2006 IBM Corporation IBM WebSphere Portlet Factory Architecture.
COMP 321 Week 7. Overview HTML and HTTP Basics Dynamic Web Content ServletsMVC Tomcat in Eclipse Demonstration Lab 7-1 Introduction.
Chapter 8 Script-free pages. Problem with scripting in JSP When you use scripting (declaration, scriplet, expressions) in your JSP, you actually put Java.
Struts J2EE web application framework “ Model 2 ” Model View Controller Controller Servlet Key features XML metadata Struts taglib Simplified form validation.
Lecturer: Prof. Piero Fraternali, Teaching Assistant: Alessandro Bozzon, Advanced Web Technologies: Struts–
J2EE Overview Web Programming CSCI J2EE multi-tier architecture Servlet: Java class loaded into Web server JSP page: enhanced HTML page that is.
JSP Filters 23-Oct-15. JSP - FILTERS A filter is an object that can transform a request or modify a response. Filters are not servlets; they don't actually.
Chapter 2 Web app architecture. High-level web app architecture  When a client request coming in and needs servlet to serve dynamic web content, what.
Struts Framework Anna Paščenko. What is Struts?  An open source framework for building Java web applications.
Struts 2 introduction. Struts 2 framework Struts 2 A full-featured web application framework for the Java EE platform The Java Servlet API exposes the.
REVOLUTION TO NEXT GENERATION Struts2.0 20/02/ Avishek Arang ::
CSC 2720 Building Web Applications Frameworks for Building Web Applications.
Server-side Programming The combination of –HTML –JavaScript –DOM is sometimes referred to as Dynamic HTML (DHTML) Web pages that include scripting are.
Chính phủ điện tử TS. Phạm Văn Tính Khoa CNTT, ĐH Nông Lâm TP.HCM
Apache Struts. J2EE Web Application using MVC design pattern Why MVC? Separate components = easier maintenance – Model component holds object data – View.
® IBM Software Group © 2007 IBM Corporation Servlet Filtering
Servlet Filters JAVA Enterprise Edition. Servlet Filters Servlet Filters are Java classes that can be used in Servlet Programming for the following purposes:
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Spring MVC Essentials Getting started.
CS320 Web and Internet Programming Introduction to Java Servlets Chengyu Sun California State University, Los Angeles.
JAVA BEANS JSP - Standard Tag Library (JSTL) JAVA Enterprise Edition.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
©SoftMoore ConsultingSlide 1 Filters. Filters can be used in a web application to intercept, examine, and possibly transform requests or responses associated.
Preface IIntroduction Objectives I-2 Course Overview I-3 1Oracle Application Development Framework Objectives 1-2 J2EE Platform 1-3 Benefits of the J2EE.
The Chain of Responsibility Pattern (Behavioral) ©SoftMoore ConsultingSlide 1.
10 Copyright © 2004, Oracle. All rights reserved. Building ADF View Components.
APACHE STRUTS ASHISH SINGH TOMAR ast2124. OUTLINE Introduction The Model-View-Controller Design Pattern Struts’ implementation of the MVC Pattern Additional.
Chapter 2 Java Struct 2. Content Basic MVC Architecture Struts 2 Overview Struts 2 - Architecture.
SDJ INFOSOFT PVT. LTD. 2 BROWSERBROWSER JSP JavaBean DB Req Res Application Layer Enterprise server/Data Sources.
Apache Struts Technology A MVC Framework for Java Web Applications.
Model View Controller. MVC is the separation of model, view and controller. It's simply a paradigm; an ideal that you should have in the back of your.
CS 562 Advanced Java and Internet Application Computer Warehouse Web Application By Team Alpha :-  Puja Mehta (102163)  Mona Nagpure (102147)
CS3220 Web and Internet Programming Introduction to Java Servlets
Course Outcomes of Advanced Java Programming AJP (17625, C603)
Servlets Hits Counter 20-Jul-18.
Unit 6-Chapter 2 Struts.
Introduction to Struts
Java Web Application Framework
The Model Layer What is Model?
Java Servlets and JSP.
Directories and DDs 25-Apr-19.
Directories and DDs 21-Jul-19.
Directories and DDs 14-Sep-19.
Presentation transcript:

Lecture 2 - Struts ENTERPRISE JAVA

2 Contents  Servlet Deployment  Servlet Filters  Model View Controllers  Struts  Dependency Injection

3 Application Deployment  Specifies how a web application is to be deployed in a Servlet container like Tomcat  ROOT/WEB-INF/web.xml  A mapping between a URL pattern and Servlet class  Normally auto generated by Eclipse for you – but can sometimes need some manual tweaking

4 Application Deployment – web.xml Struts Example Test Test /Test Servlet class definition Servlet class-URL mapping

5 Servlet Filters - javax.servlet.Filter  Intercept and modify page requests and responses  Authentication  Logging  Compression ...  Used to wire up Struts and other frameworks  Simple class structure - doFilter(ServletRequest, ServletResponse, FilterChain)

6 Filters – web.xml struts2 org.apache.struts2.dispatcher.FilterDispatcher struts2 *.action

7 Model View Controller  Separate business logic, database, access, presentation, and control flow components  Model – classes used to store and manipulate state, typically in a database of some kind.  View – presentation layer / user interface used to render the model to the user  Controller – acts as a bridge between user input and the model and the view.

8 Struts  MVC Framework  Controller – is the Servlet based dispatch filter  Model – is the Action a Plain Old Java Object (POJO)  View – is the output JSP  Framework is wired up using XML and is bootstrapped via the dispatch filter in web.xml file  Framework uses dependency injection based on reflection to set properties on objects automatically

10 Action Class  The model class where all of the business logic takes place  A simple POJO that needs to comply with Struts framework conventions  Needs to have a public String execute() method which is the where the main body of code will go  Needs setters and getters to get access to the classes data items  Can create setters to get access to other resources like the HttpServletResponse object

11 Struts – Dependency Injection  Delegates responsibility for object creation and linking from the objects themselves to a factory  The object factories are managed internally by the Struts framework’s inversion of control container  Basically – a router that creates and links objects when required – based on parameter type and name of setter method  Factories for creating DataSource objects, Sockets etc.

12 Struts – Dependency Injection  Partially wired up with XML see struts.xml and automatically using inversion of control public class SimpleQuery { private String genre; HttpServletResponse response; public void setServletResponse(HttpServletResponse response) { this.response = response; } public String execute(){ try { PrintWriter out = response.getWriter(); } catch (IOException e) { // handle the exception... } …

13 Struts - Configuration <constant name="struts.enable.DynamicMethodInvocation" value="false" /> <constant name="struts.custom.i18n.resources" value="ApplicationResources" /> query.jsp

14 Struts View Layer  Uses JSP can use other technologies as well like Velocity Macros, Free Maker etc.  Struts has its own tab library to define common HTML widgets

15 Summary  Struts is plumbing, helps separate business logic from the presentation layer  Struts wires things up initially with XML, and does the rest with dependency injection  Looks complicated but is actually quite easy  Just one technology – plenty of other frameworks that do similar things  Be able to learn a new framework  Look at Apache Wicket, JBoss Seam etc.