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

Slides:



Advertisements
Similar presentations
4 Copyright © 2005, Oracle. All rights reserved. Creating the Web Tier: Servlets.
Advertisements

3 Copyright © 2005, Oracle. All rights reserved. Designing J2EE Applications.
JSP and Servelets.
Apache Struts Technology
 Copyright Wipro Technologies JSP Ver 1.0 Page 1 Talent Transformation Java Server Pages.
Web MVC-2: Apache Struts Rimon Mikhaiel
MVC Frameworks Alternatives to coding the MVC pattern.
Struts1 Apache Struts Dr Jim Briggs. Struts2 What is Struts? Struts is an open source framework for building Java web applications Supports MVC/Model.
Struts Basics SSE USTC Qing Ding. Agenda What is and Why Struts? Struts architecture – Controller: Focus of this presentation – Model – View Struts tag.
Java Server Pages B.Ramamurthy. Java Server Pages Servlets are pure Java programs. They introduce dynamism into web pages by using programmatic content.
Application Architectures Vijayan Sugumaran Department of DIS Oakland University.
1 Java Server Pages Can web pages be created specially for each user? What part does Java play?
Apache Struts Technology A MVC Framework for Java Web Applications.
ECE356 – Database Systems Lab 1 – Building a Web Project with NetBeans Tiuley Alguindigue Lab Instructor – University of Waterloo, E & CE Dept. Fall 2013.
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.
Java Server Pages B.Ramamurthy. Topics for Discussion 8/20/20152 Inheritance and Polymorphism Develop an example for inheritance and polymorphism JSP.
1 INTRO TO BUSINESS COMPONENTS FOR JAVA (BC4J) Matt Fierst Computer Resource Team OracleWorld Session
JDeveloper 10g and JavaServer Faces: High-Performance UIs on the Web Avrom Roy-Faderman Senior Programmer May, 2006.
Design Patterns Phil Smith 28 th November Design Patterns There are many ways to produce content via Servlets and JSPs Understanding the good, the.
CSCI 6962: Server-side Design and Programming Introduction to Java Server Faces.
Jakarta Struts Presented by Object Computing, Inc. (OCI) Written by Greg Elliott
JSP Architecture Outline  Model 1 Architecture  Model 2 Architecture.
COMP 321 Week 7. Overview HTML and HTTP Basics Dynamic Web Content ServletsMVC Tomcat in Eclipse Demonstration Lab 7-1 Introduction.
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.
JSF Introduction Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written permission.
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 ….
Webcommerce Computer Networks Webcommerce by Linnea Reppa Douglas Martindale Lev Shalevich.
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)
Copyright © 2002 ProsoftTraining. All rights reserved. JavaServer Pages.
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,
CSC 2720 Building Web Applications Frameworks for Building Web Applications.
Page 1 Controller Action2.java Struts- config. xml Mappings Business Logic Layer Data Layer View Layer Business Bean 1 Jsp Engine Jsp 1 Action3.java Action4.java.
Apache Struts. J2EE Web Application using MVC design pattern Why MVC? Separate components = easier maintenance – Model component holds object data – View.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Spring MVC Essentials Getting started.
© 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.
Struts Framework Day-2 Ashok Chakravarti. DataSource Usage Sample Struts-config.xml …
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.
 Java Server Pages (JSP) By Offir Golan. What is JSP?  A technology that allows for the creation of dynamically generated web pages based on HTML, XML,
Java Programming: Advanced Topics 1 Building Web Applications Chapter 13.
Bayu Priyambadha, S.Kom. Static content  Web Server delivers contents of a file (html) 1. Browser sends request to Web Server 3. Web Server sends HTML.
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.
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.
A Presentation Presentation On JSP On JSP & Online Shopping Cart Online Shopping Cart.
CS 562 Advanced Java and Internet Application Computer Warehouse Web Application By Team Alpha :-  Puja Mehta (102163)  Mona Nagpure (102147)
V Web Tier Architecture MVC and Struts. v First, there were servlets And things were good Faster than CGI programs More scalable with built-in.
Enterprise Java v050228MVC1 Model, View, Controller Web Architecture.
Controlling an Application with Struts
Unit 6-Chapter 2 Struts.
Design and Maintenance of Web Applications in J2EE
Introduction to Struts
The Model Layer What is Model?
JavaServer Faces: The Fundamentals
Struts BY: Tejashri Udavant..
Presentation transcript:

Web Development with Karsten Schulz Terp-Nielsen Master Principal Sales Consultant Oracle Denmark

Agenda  JDeveloper 10g overview  Application Developer Framework (ADF)  Web Development with Struts

Full Lifecycle Support Deploy Test Build Design DebuggingTuning Data Modeling ApplicationModeling Coding Deployment ConfigurationManagement IDEPlatform Infrastructure

JDeveloper Framework Support  J2EE Frameworks – Application Development Framework (ADF) – Apache Struts support – ADF Business Components – Oracle 9i/AS10g Toplink – UiX – Java Server Faces (JSF)

 Implements standard J2EE best practices  Model-View-Controller (MVC) design pattern  Focus on the application, not the “plumbing”  Consolidation and evolution of previous frameworks Oracle ADF End-to-end J2EE Framework Business Services Web and Wireless Clients Rich Clients Model Controller

ADF – Productivity With Choice View Controller Model Business Services Swing / JClientJSPADF UIXJSF Rich ClientWeb / Wireless Struts ADF Bindings ADF Data Control Java Classes EJB Session Beans Web Services ADF Business Components Service Object JDBC EJB Finders TopLink Queries ADF Business Components Query Object Data Access ADF Business Components Entity Object Java ClassesEJB Entity Beans TopLink Mapping Persistent Business Objects ADF Metadata Services

Struts Model 1 Architecture  Browser access JSP pages – JSPs access JavaBeans that represent model  Control de-centralized – current page display, determined next page to display  Complex navigation requires use of scriplet code – Blurs the line between presentation and navigation code and making reuse difficult  Not a model to use in practice - maintenance difficult and does not scale well

Struts Model 1 Architecture Decentralized controller - in each JSP page Model 1

Struts Model 1 Architecture Servlet/ JSP Web Server Servlet/ JSP No MVC - Statically Linked Pages

Struts Model-View-Controller ~ Model 2  Introduces a controller servlet – Controller Servlet handle the data access and navigational flow – JSPs handle presentation  Controller centralizes the logic for dispatching requests to the next view based on the request URL, input parameters, and application state  Controller also handles view selection, which decouples JSP pages and servlets from one another

State Change Change Notification State Query Struts Model-View-Controller ~ Model 2 Servlet JavaBean Enterprise JavaBean Controller JSP View HTTP Request HTTP Response View Selection Database Model JDBC DB User Actions

Struts Model-View-Controller ~ Model 2 Servlet/JSP Controller Web Server Applying MVC to a Page Flow

Struts What is It ?  Open source Apache Jakarta Project  An implementation of MVC paradigm  A framework written in Java, to build web tier employing servlets, JSPs and XML  De facto standard for J2EE MVC applications  Bundled with JDeveloper and works on OC4J

Struts Components  ActionServlet class – Part of controller that receives user input and state changes and issues view selections  Action class – Part of controller that interacts with model to execute a state change or query  ActionForm Beans – Data (from Form) bundled into Javabean for reuse and perform validation  ActionForward class – stores path to a page where the user is sent to  ActionMapping – holds mapping that tells controller which Actions, ActionForms, ActionsForwards to use

Struts Components (2)  Struts-config.xml – Glue of the framework - holds declarations of the earlier listed components and other details. ActionServlets reads this file and create the configuration objects in memory  Strut Tag Libraries – Custom tags that simplify working with Struts aiding the view component and access Model thru’ Java Beans  Property files – store messages and handle different languages

Struts Struts Pictorially Page 1 Controller Action2.java Struts- config. xml Mappings Business Logic Layer Data Layer View Layer Business Bean 1 JSP Engine Jsp 1 Action3.java Action4.java Action1.java Business Bean 2 Business Bean 3 Jsp 3 Form Bean 1 Form Bean 2 Other Bean 1 request/session Web Browser Database path action [form bean] [forwards] App Server Jsp 2 JDBC

Struts ActionForm  Holds state and behavior for user input  ActionForms are JavaBeans with reset() and validate() methods for user input  ActionForm extends org.apache.struts.action.ActionForm  Typically one ActionForm bean created for each HTML form  ActionForm has corresponding property for each field on HTML form

Struts ActionForm Example public final class FAQForm extends ActionForm { private String question; private String answer;.. public String getQuestion(){ return question; } public void setQuestion(String question) { this.question = question; }.. public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); if ((getQuestion() == null) || (getQuestion().length() < 1)) errors.add("question", new ActionError("errors.question.required"));.. return errors; }

Struts Action  Action class receives the ActionForm(which holds the data) and you perform action/processing here  Action provides a loose coupling between Web tier and business tier  Controller decides which Action class, using the mapping info  Action is invoked by calling perform() method

Struts Action - Example public final class FAQQueryAction extends Action { public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { String result = null;... try { result = FAQHelper.getFAQHelper().query(actionForm, request); request.setAttribute("action", Constants.QUERY); }... return mapping.findForward( “ result ” ); }

Struts ActionMapping <action path="/faqQuery" type="faqapp.web.struts.actions.FAQQueryAction" name="FAQQueryForm" scope="request" validate="true" input="/faqQuery.do">  ActionMapping object maps the Actions to URI, or path  Specified in struts-config.xml

Struts ActionForward  Encapsulates the destination of where to send control upon completion of the Action  The destination(JSP, HTML file, servlet) is detailed in the configuration file – struts-config.xml  Objects that have logical name for referring and a path property <forward name="success" path="/WEB-INF/FAQQuery.jsp"/>

Struts ActionServlet  Primary task is to route request URI to an Action class using the configuration information(struts-config.xml)  Is the director - working behind the scene, administering the behavior of controller  Configured using web.xml of the application and mapped to receive url patterns such as *.do  Only one ActionServlet can be loaded for an application  Used as a black box in most cases, though it can be extended

Struts struts-config.xml  Holds declarations of Struts components that define the configuration  Living blueprint of your application – What fields are on the forms – Where JSPs are found – Knows about every action and the resources needed  Power and flexibility of Struts is due to extracting out configuration information, across the frame work into struts-config.xml

Struts struts-config.xml - Example <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN ” " <form-bean name="FAQQueryForm “ type="faqapp.web.struts.forms.FAQQueryForm" /> <action path="/faqQuery" type="faqapp.web.struts.actions.FAQQueryAction" name="FAQQueryForm" scope="request" validate="true" input="/faqQuery.do">

Struts A Look into web.xml action org.apache.struts.action.ActionServlet application ApplicationResources config /WEB-INF/struts-config.xml debug 2 detail 2

gets data to display (adds to beans in request/session)…or saves data from beans via business rules creates/reuses any associated form bean creates looks up path to determine action/ form bean interacts with lower layers - acts as adaptor between HTTP and layers below if submit, auto populates form bean from request params Page 1 Controller Action2.java Struts- config. xml Mappings Business Logic Layer Data Layer View Layer Business Bean 1 Jsp Engine Jsp 1 Action3.java Action1.java Business Bean 2 Business Bean 3 Jsp 2Jsp 3 Form Bean 1 Form Bean 2 request/session Web Browser Business Data reads on start-up incoming requests path action [form bean] [forwards] passes control to relevant action to handle returns appropriate forward relevant page called processes custom tags – fill form elements from beans, display internationalized messages pure HTML sent to browser Jsp 2 Action2.java Form Bean 2 Application Server Jsp 2 How it all Works

Struts JSP Tag Libraries  HTML JSP custom tags – bridge between a JSP view and the other components of a Web application – Tags relating to HTML forms, message and error handling, maintaining hyperlinks and internalization  Bean JSP custom tags – Tags useful for accessing beans, their properties,and defining beans based on access – Create new beans based on the value of request cookies, headers, and parameters in any scope  Logic tags – Tags for conditional generation of output text, looping, comparison/sub-string matching

Struts Using Struts JSP tags Welcome! Welcome ! Welcome World! Sign in Sign out

Demonstration Develop a Web Application based on Struts and EJBs as the model