Java and Web. WebWork



Similar documents
Web Frameworks and WebWork

Model-View-Controller. and. Struts 2

Java Servlet 3.0. Rajiv Mordani Spec Lead

Web Applications and Struts 2

Java Servlet and JSP Programming. Structure and Deployment China Jiliang University

Web Container Components Servlet JSP Tag Libraries

Servlet 3.0. Alexis Moussine-Pouchkine. mercredi 13 avril 2011

Web Application Programmer's Guide

Server Setup and Configuration

BAPI. Business Application Programming Interface. Compiled by Y R Nagesh 1

Introduction to J2EE Web Technologies

ACM Crossroads Student Magazine The ACM's First Electronic Publication

Web Applications. Originals of Slides and Source Code for Examples:

Supplement IV.E: Tutorial for Tomcat. For Introduction to Java Programming By Y. Daniel Liang

Web Applications. For live Java training, please see training courses at

Controlling Web Application Behavior

Principles and Techniques of DBMS 5 Servlet

Java EE 6 Ce qui vous attends

Java Web Programming. Student Workbook

Developing Web Applications using JavaServer Pages and Servlets

Volume 1: Core Technologies Marty Hall Larry Brown. An Overview of Servlet & JSP Technology

Piotr Nowicki's Homepage. Java EE 6 SCWCD Mock Exam. "Simplicity is the ultimate sophistication." Important!

Virtual Open-Source Labs for Web Security Education

Creating Java EE Applications and Servlets with IntelliJ IDEA

CONTROLLING WEB APPLICATION BEHAVIOR WITH

DTS Web Developers Guide

In this chapter, we lay the foundation for all our further discussions. We start

In this chapter the concept of Servlets, not the entire Servlet specification, is

Programming on the Web(CSC309F) Tutorial: Servlets && Tomcat TA:Wael Aboelsaadat

Web Application Architecture (based J2EE 1.4 Tutorial)

PowerTier Web Development Tools 4

CSI 2132 Lab 8. Outline. Web Programming JSP 23/03/2012

An Overview of Servlet & JSP Technology

Managing Data on the World Wide-Web

SSC - Web applications and development Introduction and Java Servlet (II)

Pure server-side Web Applications with Java, JSP. Application Servers: the Essential Tool of Server-Side Programming. Install and Check Tomcat

JSP. Common patterns

2. Follow the installation directions and install the server on ccc

Java Servlet Tutorial. Java Servlet Tutorial

PA165 - Lab session - Web Presentation Layer

INTRODUCTION TO WEB TECHNOLOGY

Java EE Introduction, Content. Component Architecture: Why and How Java EE: Enterprise Java

WebService Security. A guide to set up highly secured client-server communications using WS-Security extensions to the SOAP protocol

Course Name: Course in JSP Course Code: P5

Web Service Development Using CXF. - Praveen Kumar Jayaram

CHAPTER 9: SERVLET AND JSP FILTERS

MODULAR JAVA WEB APPLICATIONS

How To Understand The Architecture Of Java 2Ee, J2Ee, And J2E (Java) In A Wordpress Blog Post

The Server.xml File. Containers APPENDIX A. The Server Container

Simplify Your Web App Development Using the Spring MVC Framework

Outline. CS 112 Introduction to Programming. Recap: HTML/CSS/Javascript. Admin. Outline

Oracle Hyperion Financial Management Custom Pages Development Guide

Java 2 Web Developer Certification Study Guide Natalie Levi

Web Development on the SOEN 6011 Server

Java Web Programming with Eclipse

Development of a Real-time Customer Service System. Abstract

WebSphere v5 Administration, Network Deployment Edition

On-campus Tomcat Deployment Client

An introduction to web programming with Java

Installation Guide for contineo

BIRT Application and BIRT Report Deployment Functional Specification

Web Programming II JSP (Java Server Pages) ASP request processing. The Problem. The Problem. Enterprise Application Development using J2EE

Web Application Development

NetBeans IDE Field Guide

Crawl Proxy Installation and Configuration Guide

Outline. Lecture 9: Java Servlet and JSP. Servlet API. HTTP Servlet Basics

5- Web application deployment

White Paper March 1, Integrating AR System with Single Sign-On (SSO) authentication systems

Application Security

Getting Started with Web Applications

Developing a Web Server Platform with SAPI Support for AJAX RPC using JSON

1 How to install CQ5 with an Application Server

Learning GlassFish for Tomcat Users

OPENRULES. Release TUTORIAL Cloud Application Development

NetBeans IDE Field Guide

ServletExec TM 5.0 User Guide

JAX-WS Developer's Guide

CHAPTER 5. Java Servlets

Mastering Tomcat Development

Exam Prep. Sun Certified Web Component Developer (SCWCD) for J2EE Platform

Install guide for Websphere 7.0

Oracle Hyperion Financial Management Developer and Customization Guide

How to use JavaMail to send

Introduction to Web Technologies

Università degli Studi di Napoli Federico II. Corsi di Laurea Specialistica in Ingegneria Informatica ed Ingegneria delle Telecomunicazioni

Servlets. Based on Notes by Dave Hollinger & Ethan Cerami Also, the Online Java Tutorial by Sun

Programma corso di formazione J2EE

An introduction to creating JSF applications in Rational Application Developer Version 8.0

Enterprise Application Development In Java with AJAX and ORM

Class Focus: Web Applications that provide Dynamic Content

Automatic generation of distributed dynamic applications in a thin client environment

Please send your comments to:

11.1 Web Server Operation

Transcription:

Java and Web WebWork

Client/Server server client request HTTP response

Inside the Server (1) HTTP requests Functionality for communicating with clients using HTTP CSS Stat. page Dyn. page Dyn. page Our web application Application functionality service layer persistence layer database

Inside the Server (2) HTTP requests Web server How does the web server know how to access resources in our application? CSS Stat. page Dyn. page Dyn. page Our web application Application functionality service layer persistence layer database

Meet: Java Servlet Specification (JSR154) Java Servlet API A servlet is a Java(TM) technology-based Web component, managed by a container, that generates dynamic content. Like other Java technology-based components, servlets are platform-independent Java classes that are compiled to platform-neutral byte code that can be loaded dynamically into and run by a Java technology-enabled Web server. Containers, sometimes called servlet engines, are Web server extensions that provide servlet functionality. Servlets interact with Web clients via a request/response paradigm implemented by the servlet container. The servlet container is a part of a Web server or application server that provides the network services over which requests and responses are sent, decodes MIME-based requests, and formats MIME-based responses. A servlet container also contains and manages servlets through their lifecycle.

Servlets (1) package javax.servlet; public interface Servlet { public void service(servletrequest req, ServletResponse res); } //.. other methods Servlets are generic, but are mostly used in conjunction with HTTP The Servlet API has one generic package and one HTTP specific package: javax.servlet; javax.servlet.http;

Servlets (2) package javax.servlet.http; public abstract class HttpServlet extends GenericServlet { protected void doget(httpservletrequest req, HttpServletResponse res); protected void dopost(httpservletrequest req, HttpServletResponse res); } //.. other methods GenericServlet implements the servlet interface Servlet The servlets are singletons and instantiated by the servlet container

Servlet Mapping The web application is required to have a web.xml file in a specific location. The web.xml file can contain URL-to-servlet mappings The servlet container reads the web.xml file and transforms and forwards requests according to the mappings web.xml: <web-app>... <servlet> <servlet-name>feedback-servlet</servlet-name> <servlet-class>no.uio.inf5750.app.servlet.feedback</servlet-class> </servlet> <servlet-mapping> <servlet-name>feedback-servlet</servlet-name> <url-pattern>/feedback</url-pattern> </servlet-mapping>... </web-app>

Web Archive WAR file: A zip file which can contain web resources and dependent libraries in addition to the contents of a regular JAR file Structure of a WAR file: / Web resources (images, CSS files, etc) /WEB-INF/ Private files and directories (not to be returned by the web server) /WEB-INF/web.xml web.xml /WEB-INF/classes/ Classes and application resources (typical contents of a JAR file) /WEB-INF/lib/*.jar Dependent libraries /index.html /styles.css /images/me.png /WEB-INF/web.xml /WEB-INF/classes/no/uio/inf5750/app/servlet/Feedback.class /WEB-INF/lib/my-app-func.jar /WEB-INF/lib/servlet-api.jar /WEB-INF/lib/hibernate.jar

Other Mappable Classes javax.servlet.filter Around interceptors for servlet requests Various listeners Context listeners HTTP session listeners

Inside the Server (3) HTTP requests Web server/servlet container CSS Stat. page Servlet Servlet Our web application, packaged as a WAR file /WEB-INF/web.xml Application functionality service layer persistence layer database

Inside the Server (4) HTTP requests Web server/servlet container CSS Stat. page Web framework Our web application, packaged as a WAR file /WEB-INF/web.xml Action Action Application functionality service layer persistence layer database

WebWork (1) Latest version is 2.2.6 - www.opensymphony.com/webwork Based on XWork (command pattern framework) Redirects requests to action classes, and returns a result based on the outcome of the action class execution Supports: validation type conversion IoC interceptors i18n views/result types (Velocity, FreeMarker, JSP,...) modularization - namespaces

WebWork (2) Web server web.xml (*.action) WebWork dispatcher xwork.xml (action/result mappings) Action Action Result Result Application functionality

WebWork and Spring Web server web.xml (*.action) WebWork dispatcher Spring application context xwork.xml (action/result mappings) Action Action Result Result Application functionality

Web Servers/Servlet Containers Tomcat Jetty Wikipedia lists 23 servlet containers: http://en.wikipedia.org/wiki/java_servlet#servlet_containers

WebWork Example Downloadable from the Teaching plan http://www.uio.no/studier/emner/matnat/ifi/inf5750/h07/undervisningsplan.xml

Rules for Web Modules in DHIS 2 Must depend on dhis-web-commons (jar) dhis-web-commons-resources (war, <type>war</type>) XWork package must include and extend dhis-web-commons instead of webwork-default have the same name as the artifactid have the same namespace as the artifactid (with a leading /) webwork.properties is defined centrally

Typical Action Mapping in DHIS 2 <action name="dataelement" class="org.hisp.dhis.dd.action.dataelement.getdataelementlistaction"> <result name="success" type="velocity">/main.vm</result> <param name="page"> /dhis-web-maintenance-datadictionary/dataelement.vm</param> <param name="menu"> /dhis-web-maintenance-datadictionary/menu/mainmenu.vm</param> <param name="javascripts"> javascript/dataelement.js, javascript/filtertable.js </param> <interceptor-ref name="transactionstack"/> </action>

Questions?