Struts2 Plugin Development - Extending Struts2 Justin Yip.

Slides:



Advertisements
Similar presentations
Castafiore platform Consists or intend to consist of 1.Advanced Web framework 2.Advanced Graph database 3.Designer studio (something like visual basic)
Advertisements

Developing in CAS. Why? As distributed you edit CAS 3 with Eclipse and build with Maven 2 – Best Practice for Release Engineering – Difficult edit-debug.
Extreme User Interfaces for Alfresco Kevin Dorr Sr. Solutions Engineer Americas Channel.
Goals Give you a feeling of what Eclipse is.
My First Building Block Presented By Tracy Engwirda 28 September, 2005.
Internet Technologies 1 Master of Information System Management Java Server Faces Model/View/Controller Design Pattern for Web Development Slides.
Java Server Faces Model/View/Controller Design Pattern for Web Development Slides adapted from “Core JavaServer Faces” by Geary and Horstmann and the J2EE.
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.
Session-02. Index. Jsp in Struts 2 Web.xml File in Struts 2.
Web Applications Basics. Introduction to Web Web features Clent/Server HTTP HyperText Markup Language URL addresses Web server - a computer program that.
Struts 2.0 an Overview ( )
UNIT-V The MVC architecture and Struts Framework.
Spring Roo CS476 Aleksey Bukin Peter Lew. What is Roo? Productivity tool Allows for easy creation of Enterprise Java applications Runs alongside existing.
WebWork in Action An introduction to WebWork Patrick A. Lightbody.
Pittsburgh Java User Group– Dec Java PureFaces: A JSF Framework Extension.
MAVEN-BLUEMARTINI Yannick Robin. What is maven-bluemartini?  maven-bluemartini is Maven archetypes for Blue Martini projects  Open source project on.
Building a UI with Zen Pat McGibbon –Sales Engineer.
© 2005 by IBM; made available under the EPL v1.0 | March 1, 2005 Tim deBoer Gorkem Ercan Extend WTP Server Tools for your.
Developing for Selenium Grid
Magnolia Modules. Architecture Web Application (WAR) Magnolia CoreGUICache Modules DMS 2.3Data 1.1Scheduler Custom Project Base 2.2 Project.
Web Applications - Basics. Introduction to Web Web features Clent/Server HyperText Transfer Protocol HyperText Markup Language URL addresses Web server.
Extending ArcGIS for Server
CHEF II / Sakai Architecture. CHEF II Changes uPortal replaces Jetspeed –jsr 168 portlet, servlet compliant Spring replaces Turbine component framework.
Introduction to Web Dimitar Nenchev Ivan Nakov
1 Geospatial and Business Intelligence Jean-Sébastien Turcotte Executive VP San Francisco - April 2007 Streamlining web mapping applications.
1 Apache TomEE // JavaEE Web Profile on Tomcat Jonathan #TomEE.
Chapter 7 Using Custom Tag Libraries and the JSP Standard Tag Library.
JAVA SERVER FACES ADITI RAJORIYA UNI – ar2630. POINTS TO BE DISSCUSED WHAT IS JSF? WHY JSF? ARCHITECTURE JSF VERSIONS UI COMPONENTS JSF STRUCTURE AND.
JSP Tag Libraries Lec Last Lecture Example We incorporated JavaBeans in “Course Outline” Example But still have to write java code inside java.jsp.
JSF Framework Java Server Faces Presented by Songkran Totiya (6/10/2014)
JavaScript Framework for Rich Apps in Every Browser Maura Wilder Joan Wortman
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 ::
Struts 2 - The modern web application framework By Nalin De Zoysa
Chính phủ điện tử TS. Phạm Văn Tính Khoa CNTT, ĐH Nông Lâm TP.HCM
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.
Extending & Customizing XNAT with Modules Rick Herrick
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Spring MVC Essentials Getting started.
Maven for building Java applications By Nalin De Zoysa
Plug-in Architectures Presented by Truc Nguyen. What’s a plug-in? “a type of program that tightly integrates with a larger application to add a special.
Preface IIntroduction Objectives I-2 Course Overview I-3 1Oracle Application Development Framework Objectives 1-2 J2EE Platform 1-3 Benefits of the J2EE.
13 Copyright © 2004, Oracle. All rights reserved. Adding Validation and Error Handling.
Bulding a Modular Application with Coherence David Whitmarsh Independent Contractor Technical Architect Investment Banks
Implementation Struts Framework for well-architectured web applications Model-View-Controller design pattern.
Modern Programming Language. Web Container & Web Applications Web applications are server side applications The most essential requirement.
Applications Kay Kasemir ORNL/SNS Using Information and pictures from Matthias Clausen, Jan Hatje, and Helge Rickens (DESY) October 2007.
Java Programming: Advanced Topics 1 Building Web Applications Chapter 13.
© 2009 by IBM; made available under the EPL v1.0 | Feb 1, 2009 Seneca 2009 Tim deBoer Gorkem Ercan Extend WTP Server Tools.
Chapter 2 Java Struct 2. Content Basic MVC Architecture Struts 2 Overview Struts 2 - Architecture.
Testing Your Alfresco Add-ons Michael Suzuki Software Engineer.
#SummitNow Alfresco 4.2 Share Development Workshop November 6, 2013 Kevin Dorr, Sr. Solutions Engineer, Alfresco US.
Maven. Introduction Using Maven (I) – Installing the Maven plugin for Eclipse – Creating a Maven Project – Building the Project Understanding the POM.
CS520 Web Programming Introduction to Maven Chengyu Sun California State University, Los Angeles.
Struts 2 Development. Topics  Roles in Struts Development  Control Flow  Actions  Struts 2 Views and Target  Struts 2 Custom Tags  Validation 
The Share Widget Library
CS520 Web Programming Introduction to Maven
Goals Give you a feeling of what Eclipse is.
Getting Started with Alfresco Development
Google Web Toolkit Tutorial
Overall Architecture and Component Model
The J2EE Framework Java Technologies External Application.
Unit 6-Chapter 2 Struts.
Introduction to Struts
JavaServer Faces: The Fundamentals
The JSF Tools Project – WTP (internal) release review
AJAX Toolkit Framework
CS4961 Software Design Laboratory Understand Aquila Backend
JAVA APPLET PREPARED BY Mr. Jahanzaib Ahmed
Plug-In Architecture Pattern
Presentation transcript:

Struts2 Plugin Development - Extending Struts2 Justin Yip

2 Roadmap Plugin Architecture Extension points Static resources Tag development

3 Plugin Architecture Struts 2 provides a simple plugin architecture so that developers can extend the framework just by adding a JAR to the application's classpath. Struts2 Plugins are contained in a JAR Contains classes and configurations Extend, replace, or add to exsiting Struts framework functionality The JAR should contain a struts-plugin.xml file

4 Sample struts-plugin.xml

5 Roadmap Plugin Architecture Extension points Static resources Tag development

6 Struts2 Plugin provides Packages Interceptors Results Actions Core component Extensions Constants

7 Core component Extension Points typekey com.opensymphony.xwork2.ObjectFactorystruts.objectFactory com.opensymphony.xwork2.ActionProxyFactorystruts.actionProxyFactory com.opensymphony.xwork2.util.ObjectTypeDeterminerstruts.objectTypeDeterminer org.apache.struts2.dispatcher.mapper.ActionMapperstruts.mapper.class org.apache.struts2.dispatcher.multipart.MultiPartRequeststruts.multipart.parser ……

8 Example Plugins

9 Json-plugin Struts2 json plugin can serializing java objects to json objects The plugin Defines a package“json-default” , a reslut type “json” and a interceptor within

1010 Spring-plugin Extending core component : com.opensymphony.xwork2.ObjectFactory

1 Config Browser Plugin See an application's configuration at runtime. It is a small struts2 application. Provide actions, freemarker pages and stylesheets.

1212 Redwork Plugin The feature “zero config” of redwork plugin was implemented by Extending “com.opensymphony.xwork2.UnknownHandler”. RedworkUnknownHandler lookups actions and freemarker pages automatically, without a single line of configuration in struts.xml.

1313 Grid widgets The widgets provides a common action, a unified grid request handler.

1414 Roadmap Plugin Architecture Extension points Static resources Tags

1515 Static resources Some plugin, UI widgets in particular, need to provide static resource(stylesheets, images, etc…) within plugin archive. With struts2 plugin mechanism, you can package these resources in jar. Static resources are placed under “/static” in plugin jar, and we can refer it in page using “/static” as the path. Assuming “/static/background.jpg” is inside a plugin jar, And we refer it:

1616 Roadmap Plugin Architecture Extension points Static resources Tag development

1717 Next we will create an example tag - accordion

1818 Creating a new Project 1. Create a new Maven2 project “widgets-accordion” using Archetype: “maven- archetype-quickstart” 2. Fill out Group Id, Artifact Id, version etc.

1919 Creating a new Project 3. Change compiler level to 1.5 Config “maven-compiler-plugin” below: Update project facts using “mvn eclipse:eclipse”

2020 Creating a new Project 4. Add maven dependency org.apache.strutsstruts2-core org.apache.strutsstruts2-json-plugin javax.servletservlet-api javax.servlet.jspjsp-api junitjunit

2121 Plugin Entry point 5. Create a struts2 plugin configuration 6. declare a bean of type “org.apache.struts2.views.TagLibrary”, named “com.redhat.widget.DemoTagLibrary” Perfix with “rw”

2 Class Diagram

2323 The class  A custom tag library must be descendant of “org.apache.struts2.views.TagLibrary  Here we support freemarker only  Return an new instance of DemoModel in getFreemarkerModels

2424 The freemarker model accordion.ftl

2525 The AccordionModel  Returns the tag bean in getBean() method

2626 Accordion Theme selecting Template selecting Tld class for jsp

2727 Handling params Extra params from value stack Retrieve param value from tag xxx.ftl

2828 View template accordion.ftl accordion-close.ftl

2929 Test Drive Install the artifact using “mvn install” Test this tag in demo project Test our API : $("#a1").trigger("accordion-foldAll")