Introduction to Jakarta Struts Framework Try NCCU Computer Center Mar 20,2002.

Slides:



Advertisements
Similar presentations
Web Development with Karsten Schulz Terp-Nielsen Master Principal Sales Consultant Oracle Denmark.
Advertisements

Apache Struts Technology
Web MVC-2: Apache Struts Rimon Mikhaiel
MVC Frameworks Alternatives to coding the MVC pattern.
Model-View-Controller ("MVC") This is a architectural design pattern for interactive applications. This design pattern organizes an interactive application.
Struts1 Apache Struts Dr Jim Briggs. Struts2 What is Struts? Struts is an open source framework for building Java web applications Supports MVC/Model.
Object-Oriented Enterprise Application Development Tomcat 3.2 Configuration Last Updated: 03/30/2001.
28/1/2001 Seminar in Databases in the Internet Environment Introduction to J ava S erver P ages technology by Naomi Chen.
Struts Basics SSE USTC Qing Ding. Agenda What is and Why Struts? Struts architecture – Controller: Focus of this presentation – Model – View Struts tag.
Java 2 – Enterprise Edition Kevin J. LaFata April 21, 2003 UM – St. Louis.
© 2005, Cornell University. Rapid Application Development using the Kuali Architecture (Struts, Spring and OJB) A Case Study Bryan Hutchinson
Java Server Faces Model/View/Controller Design Pattern for Web Development Slides adapted from “Core JavaServer Faces” by Geary and Horstmann and the J2EE.
Objectives:1. Investigate the Web application deployment descriptor 2. Install and deploy Tomcat and struts 3. Design and deploy a struts application Struts.
Q: According to Intel, the Pentium conforms to the IEEE standards 754 and 854 for floating point arithmetic. If you fly in aircraft designed using a Pentium,
Application Architectures Vijayan Sugumaran Department of DIS Oakland University.
Apache Struts Technology A MVC Framework for Java Web Applications.
Introduction to Java web programming Dr Jim Briggs JWP intro1.
Struts 2.0 an Overview ( )
Struts. Agenda Preface Struts and its components An example The architecture required for Struts Applications.
UNIT-V The MVC architecture and Struts Framework.
Lecture 2 - Struts ENTERPRISE JAVA. 2 Contents  Servlet Deployment  Servlet Filters  Model View Controllers  Struts  Dependency Injection.
Introduction to the Jakarta Struts Framework  The Topics: JavaServer Pages (JSP) Overview JSP Tags and Tag Libraries Overview Model – View – Controller.
Java Frameworks Indy Java Users Group January 29, 2003.
Web Applications Harry R. Erwin, PhD University of Sunderland CIT304/CSE301.
Copyright © 2012 Accenture All Rights Reserved.Copyright © 2012 Accenture All Rights Reserved. Accenture, its logo, and High Performance Delivered are.
Chapter 17 - Deploying Java Applications on the Web1 Chapter 17 Deploying Java Applications on the Web.
Introduction to MVC and the Jakarta Struts Framework By Gyanendra Dwivedi Software Consultant.
JavaServer Faces Jeff Schmitt October 5, Introduction to JSF Presents a standard framework for building presentation tiers for web applications.
Design Patterns Phil Smith 28 th November Design Patterns There are many ways to produce content via Servlets and JSPs Understanding the good, the.
Jakarta Struts Presented by Object Computing, Inc. (OCI) Written by Greg Elliott
Standalone Java Application vs. Java Web Application
8/15/2003System Specialists Corporation How to implement BC4J with the Struts Framework Eugene Sicat Technical Architect/Project Manager System Specialists.
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–
Fall CIS 764 Database Systems Design L8. Web ….
J2EE Overview Web Programming CSCI J2EE multi-tier architecture Servlet: Java class loaded into Web server JSP page: enhanced HTML page that is.
Java Web Development with NetBeans IDE -- Kai Qian Chapter 5 JavaServer Faces (JSF) Technology.
JSF Framework Java Server Faces Presented by Songkran Totiya (6/10/2014)
Struts Framework Anna Paščenko. What is Struts?  An open source framework for building Java web applications.
J2EE Struts 1 3 Struts: Introduction 1 4 Once you’ve coded a lot of JSP applications, you find yourself doing a lot of repetitive things. Also,
Model View Controller Architecture of Java Web Applications Dr. M V S Peri Sastry, Ph.D.[BITS-Pilani]
Apache Struts. J2EE Web Application using MVC design pattern Why MVC? Separate components = easier maintenance – Model component holds object data – View.
Markus Hjort Reaktor Innovations Java Web Development T WWW-palvelun HUT
Page 1 R MVC Design Pattern Definition Properties Describing MVC design patterns.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
Preface IIntroduction Objectives I-2 Course Overview I-3 1Oracle Application Development Framework Objectives 1-2 J2EE Platform 1-3 Benefits of the J2EE.
1 Copyright © 2004, Oracle. All rights reserved. Oracle Application Development Framework.
13 Copyright © 2004, Oracle. All rights reserved. Adding Validation and Error Handling.
11 Copyright © 2004, Oracle. All rights reserved. Customizing Actions.
Chapter 3 JSP Overview. The Problem with Servlets processing the request and generating the response are both handled by a single servlet class Java programming.
Implementation Struts Framework for well-architectured web applications Model-View-Controller design pattern.
1 Java Server Pages A Java Server Page is a file consisting of HTML or XML markup into which special tags and code blocks are inserted When the page is.
Chapter 9 Web Application Design. Objectives Describe the MVC design pattern as used with Web applications Explain the role and responsibilities of each.
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.
Ashley Montebello Katie Githens Wayne Rowcliffe. Project Overview Create graduate student review system for ECpE department Review system is used by students.
Apache Struts Technology A MVC Framework for Java Web Applications.
Java Web Development with NetBeans IDE -- Kai Qian Chapter 9 Case Study.
Enterprise Java v050228MVC1 Model, View, Controller Web Architecture.
Struts 2 Development. Topics  Roles in Struts Development  Control Flow  Actions  Struts 2 Views and Target  Struts 2 Custom Tags  Validation 
Structure of a web application
JSP (Java Server Page) JSP is server side technology which is used to create dynamic web pages just like Servlet technology. This is mainly used for implementing.
The J2EE Framework Java Technologies External Application.
Introduction to J2EE Architecture
Unit 6-Chapter 2 Struts.
Introduction to Struts
The Model Layer What is Model?
JavaServer Faces: The Fundamentals
Struts BY: Tejashri Udavant..
Presentation transcript:

Introduction to Jakarta Struts Framework Try NCCU Computer Center Mar 20,2002

The Evolution of Server Side Web Ap Developement  CGI(or ISAPI)  Servlet  JSP  JSP+Bean (Model 1)  JSP+Bean+XML techs  Model 2 (MVC)  Model 2X(MVC with XML techs)

What is MVC  The Model View Controller is a technique used to separate Business logic/state (the Model) from User Interface (the View) and program progression/flow (the Control).  This pattern is very useful when it comes to modern web development: –The majority of modern, high usage websites are dynamically driven. –People well skilled at presentation (HTML writers) seldom know how to develop back-end solutions and visa versa. –Separating business rules from presentation is good no matter what environment you develop in be it web or desktop. 資料來源 Craig W. Tataryn,Introduction to MVC and the Jakarta Struts Framework

Benefits of MVC  Promotes Modularity  I18n  Abstraction  Allows application to be defined in a flow-chart, use-case or activity diagram which is more easily transferred to implementation. 資料來源 Craig W. Tataryn,Introduction to MVC and the Jakarta Struts Framework

The Struts Framework overview  Struts is an open source MVC framework developed by the Apache Jakarta project group.  Struts allows JSP/Servlet writers the ability to fashion their web applications using the MVC design pattern.  By designing your web application using Struts you allow: –Architect the ability to design using the MVC pattern –Developer to exploit the Struts framework when building the app. –Web designer can learn how to program in MVC. 資料來源

The Struts Framework overview(2)  Struts takes much difficult work out of developing an MVC based web app.  The Struts framework provides a collection of canned objects which can facilitate fundamental aspects of MVC, while allowing you to extend further as need suites

Components of Struts Framework  Model –Business Logic Bean(or session bean) 、 StateBean(or entity bean) 、 ActionForm 。  View –A Set of Tag library. –Language Resource File  Controller –ActionServlet( controlled by struct-configs.xml) –ActionClasses  Utility Classes

Components of Struts Framework(2) 資料來源

How Struts works 資料來源

View  The view in Struts is represented by JSP pages.  Minimize the occurance of scriptlets in your page –Use the tag-library provided by Struts to control the presenatational logic.

View:I18n  The ability to maintain a web app in several different languages  Based on the language setup on the client side, the web app will automatically switch.  This is achieve in Struts through Java Resource Bundles  Instead of having to make a ResourceBundle class for each language supported by your web app, resource bundles can be described as language resource files

Traditional ChineseEnglish Demo

View:I18n(2)  Language Resource –FileName Conventions (ResourceName)_(ISO-LanguageCode)_(ISO-ConturyCode).properties –Register the Resource Name in web.xml.  In order for web developers to get at the string resources we use a special Struts tag called

View:Example  Login.jsp  ApplicationResources_en_US.properti es  ApplicationResources_zh_TW.properti es

Model  ResultBean,hold information needed to generate the result page.  FromBean(extend ActionForm ),hold the data passed by user either by POST or Query String.  Business Logic Bean.  EJB 、 JMS or other components we impl at business logic layer before.

Model:ActionForm  JSP pages acting as the view for this LogonForm are automatically updated by Struts with the current values of the UserName and Password properties.  If the user changes the properties via the JSP page, the LogonForm will automatically be updated by Struts  Before an ActionForm object is passed to a controller for processing, a “ validate ” method can be implemented on the form which allows the form to belay processing until the user fixes invalid input

Model:Example  LoginForm.java  tw.edu.nccu.user.TeacherData

Control  The controller is the switch board of MVC.  It directs the user to the appropriate views by providing the view with the correct model  The task of directing users to appropriate views is called “ mapping ” in struts.  The Struts framework provides a base object called org.apache.struts.action.ActionServlet.  The ActionServlet class uses a configuration file called struts-config.xml to read mapping data called action mappings  The ActionServlet class reads the incoming URI and tries to match the URI against a set of action mappings to see if it can find a controller class which would be willing to handle the request

Server configured to pass *.action extensions to org.apache.struts.action.ActionServlet via a web.xml configuration file ActionServlet object inspects the URI and tries to match it against an ActionMapping located in the struts-config.xml file. Instance of appropriate Action class is found and it’s perform() method is called Action object handles the request and returns control to a view based where the user is within the flow of the application Controller (2)

Control:Example  tw.edu.nccu.teacherstudata.actions.Lo ginAction  Struts-config.xml  LoginAction.java

Problems with Struts  Does not work on JDK1.4.0  Steep learning curve.  Problems on old Application Servers(include Tomcat3.2.1 、 Weblogic 5.1).  The only output document is HTML , it didn ’ t support the XSL transform technology.(Unless we modify the source code)

Model 2X  Model2X –Conceived by Julien Mercay and Gilbert Bouzeid on Feb 1,2002. –Replace the JSP+TagLib with XML+XSLT at presentation layer. –Using XSL Servlet as the Document Factory. –Support pipe-line processing while generating the target document.

Resource  Struts homepage –  Sun ’ s Servlet Specification – ml#specs  Sun ’ s JSP Specification –  Blue Stone ’ s Struts Tutorial – dll/Gallery.class/demos/trailMaps/index.jsp  My Struts page –