Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Struts Roadmap

Gary Ashley Jr. CTA, Inc. garyashley at cta dot com

Gary Ashley Jr. — Struts Roadmap Page 1 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Agenda ƒ What is Struts? ƒ What does Struts do for me? ƒ How does Struts work? ƒ Where did Struts originate? ƒ What is the future of Struts? ƒ What are the latest features?

Gary Ashley Jr. — Struts Roadmap Page 2 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Agenda (Continued) ƒ What extensions are available? ƒ Should I choose Struts? ƒ Where can I find additional information? ƒ Demo

Gary Ashley Jr. — Struts Roadmap Page 3 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

What Is Struts? ƒ The official site: ¾http://struts.apache.org

ƒ An open source framework for building Java web applications. ƒ Encourages application architectures based on Model 2 (a variation of MVC)

Gary Ashley Jr. — Struts Roadmap Page 4 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Model 2

Request (Controller) ActionServlet 1 (Model) LDAP 2 JavaBean 3

DB Browser 5 (View) Response JSP 4

Application Server Enterprise Resources

Gary Ashley Jr. — Struts Roadmap Page 5 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Core Technology ƒ Core based on: ¾Java Servlets ¾JavaBeans ¾Resource Bundles ¾XML ¾Open source technologies like Jakarta-Commons

Gary Ashley Jr. — Struts Roadmap Page 6 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

What Does Struts Do for Me? ƒ Struts provides a framework to collect input from a user, direct that input to server-side code, and forward to output page(s). ƒ Solves common problems found by “the community” while building enterprise web applications.

Gary Ashley Jr. — Struts Roadmap Page 7 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Compelling Features ƒ Validation – a very robust XML based validation framework is built into Struts. ƒ Security – you can add role based security. ƒ Internationalization (i18n) – built in support using Java resource bundles

Gary Ashley Jr. — Struts Roadmap Page 8 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

How Does Struts Work? ƒ It uses a deployment descriptor very similar to servlets. ¾struts-config.xml vs. web.xml ƒ Struts “processes” HTTP requests using a handful of components configured in the struts-config.xml file.

Gary Ashley Jr. — Struts Roadmap Page 9 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Basic Steps ƒ User fills in form & clicks “submit” ƒ HttpRequest is sent to the ActionServlet ƒ ActionServlet delegates processing to the RequestProcessor ƒ RequestProcessor loads form values into an ActionForm ƒ RequestProcessor sends ActionForm to Action

Gary Ashley Jr. — Struts Roadmap Page 10 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Basic Steps (Continued) ƒ Action implements Business Logic as the execute() method ƒ Business Logic performs application specific instructions ƒ CRUD operations, Workflow, Email, LDAP, Legacy Integration, etc. ƒ Action saves any Model data as JavaBeans to appropriate Scope

Gary Ashley Jr. — Struts Roadmap Page 11 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Basic Steps (Continued) ƒ Action returns ActionForward to RequestProcessor ƒ RequestProcessor forwards / includes / redirects to appropriate View defined in the ActionMapping ƒ View “renders” presentation including any Model data stored in JavaBeans or MessageResources to provide i18n.

Gary Ashley Jr. — Struts Roadmap Page 12 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Sample Config File

Gary Ashley Jr. — Struts Roadmap Page 13 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

ActionServlet ƒ Responsibility: ¾Boot strap configuration upon init(). ƒ Config: ¾ ƒ API: ¾This class is provided.

Gary Ashley Jr. — Struts Roadmap Page 14 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

RequestProcessor ƒ Responsibility: ¾Handles all processing of Request/Response lifecycle. ƒ Config: ¾ ƒ API: ¾This class is provided, but if default behavior is not suitable then subclass: org.apache.struts.action.RequestProcessor • Override any of the process methods required

Gary Ashley Jr. — Struts Roadmap Page 15 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

ActionMapping (aka ActionConfig) ƒ Responsibility: ¾Contains configuration information that relates the path, form-bean, and action together along with other basic instructions. This is the primary “instruction set” for the controller. ƒ Config: ¾ ƒ API: ¾This class is provided, but to include additional information you can subclass org.apache.struts.action.ActionMapping

Gary Ashley Jr. — Struts Roadmap Page 16 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Action Form ƒ Responsibility: ¾ Holds all information from the client, typically HTML form data. Perform validation of client input. ƒ Config: ¾ Uses an associated ActionFormBean (aka FormBeanConfig) for configuration: • ƒ API: ¾ Subclass (or use one of the DynaForm classes) org.apache.struts.action.ActionForm • Override reset() and validate() methods.

Gary Ashley Jr. — Struts Roadmap Page 17 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Action ƒ Responsibility: ¾This is the binding layer to business logic. Should also store any JavaBeans required by view. ƒ Config: ¾Associated to a path and form-bean, and configured using the ActionMapping ƒ API: ¾Subclass org.apache.struts.action.Action • Override the execute() method.

Gary Ashley Jr. — Struts Roadmap Page 18 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

ActionForward (aka ForwardConfig) ƒ Responsibility: ¾Typically contains the location of a JSP, tile definition, or other view component. ƒ Config: ¾ ƒ API: ¾This class is provided.

Gary Ashley Jr. — Struts Roadmap Page 19 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

ActionMessage ƒ Responsibility: ¾Constructs a message string from the resource bundle. ƒ Config: ¾ ƒ API: ¾This class is provided.

Gary Ashley Jr. — Struts Roadmap Page 20 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Where Did Struts Originate?

ƒ Initial releases 0.5 (May 2000) –1.0 (Mar 2001 )\ ¾Implemented core Model2 concept • Action perform() • FormBean validate() • ActionMapping path=“xxx.do” • ActionForward path=“nextStep.jsp” • Struts Taglibs ƒ Donated to the Apache foundation by Sun’s Chief Web Architect, Craig McClanahan

Gary Ashley Jr. — Struts Roadmap Page 21 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

1.1 Release ƒ Struts 1.1 (Aug 2003) ¾Expanded Core Features • Tiles • Plugins • Module Support • Validation ¾Explore interoperability with emerging standards • EL • JSTL • JSF

Gary Ashley Jr. — Struts Roadmap Page 22 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Latest Release ƒ Struts 1.2.4 (Sep 2004) ¾Remove deprecations from 1.0 to 1.1, and prior ¾Building greater stability and feature integration • Further module integration • Further support EL and JSTL ¾New Features • Wildcard mappings • DigestingPlugIn • MappingDispatchAction • Migrate build from Ant to Maven

Gary Ashley Jr. — Struts Roadmap Page 23 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

What Is the Future of Struts? ƒ With so many emerging standards, the future of Struts is still unclear. ƒ The current thinking is to begin 2 main branches for ongoing development: ¾1.x series – Servlet 2.2 / JSP 1.1 ¾2.x series – Servlet 2.4 / JSP 2.0

Gary Ashley Jr. — Struts Roadmap Page 24 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Development Release

ƒ Struts 1.2.5 (Oct. 17, 2004) ¾Continuing to correct bugs and cleanup codebase. ¾Migrated to Subversion ¾Website updates ¾Any new enhancements will most likely be in the 1.3.x series.

Gary Ashley Jr. — Struts Roadmap Page 25 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Future Release ƒ Struts 1.3 (late 2004, 2005) ¾Use jakarta-commons Resources ¾Separate into multiple builds • * core, apps, el, faces, site, taglib • * flow, scripting (new) ¾Allow configuration extends=“” in all other elements (similar to tiles) ¾Move core to "Struts Chain" Request Processor ¾Complete Maven migration

Gary Ashley Jr. — Struts Roadmap Page 26 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Future Release

ƒ Struts 1.4 (2005, 2006) ¾Review approach to RequestProcessor ¾Consider ActionContext ¾Enhanced support for newer servlet and jsp specs. ¾Consider adding support for Porlets by specifying an alternate Request Processor catalog

Gary Ashley Jr. — Struts Roadmap Page 27 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Future Release

ƒ Struts 2.0 (late 2005, 2006) ¾Enhanced support for using Struts in large team environments. ¾Provide broad enhancements using Servlet 2.4 and JSP 2.0 platforms ¾Comprehensive unit test coverage for all core features ¾Transparent support for a portlet environment (JSR 168), with minimal-to-no changes in your business logic and pages.

Gary Ashley Jr. — Struts Roadmap Page 28 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Future Release (Continued)

ƒ Struts 2.0 (Continued) ¾Direct support for JSTL/JSF taglibs and the JSF API ¾Enhanced support for other presentation layers, such as XLST ¾Enhanced support for scriptable Actions, using technologies like BSF or Jelly

Gary Ashley Jr. — Struts Roadmap Page 29 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

What Are the Latest Features? ƒ There are several features in ongoing development. ¾Struts EL ¾Struts Faces ¾CoRe – Chain of Responsibility Request Processor ¾Commons Resources

Gary Ashley Jr. — Struts Roadmap Page 30 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Struts EL ƒ This is a port of the Struts taglib to JSTL. ¾Any new development should focus on using this taglib.

Gary Ashley Jr. — Struts Roadmap Page 31 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Bean EL taglib ƒ All struts bean tags that provided behavior not present in JSTL have been ported. ƒ Use JSTL tags ¾ c:set, EL • Replaces: cookie, define, header, parameter ¾ c:import • Replaces: include ¾ c:out • Replaces: write

Gary Ashley Jr. — Struts Roadmap Page 32 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Logic EL taglib ƒ All struts logic tags that provided behavior not present in JSTL have been ported. ƒ Use JSTL tags ¾ c:if, c:when, EL • Replaces: empty, equal, greaterEqual, greaterThan, lessEqual, lessThan, notEmpty, notEqual

Gary Ashley Jr. — Struts Roadmap Page 33 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

HTML EL Taglib ƒ All Struts HTML tags have been ported.

Gary Ashley Jr. — Struts Roadmap Page 34 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Tiles EL Taglib ƒ As of Struts 1.2.1 the tiles taglib has been ported to JSTL

Gary Ashley Jr. — Struts Roadmap Page 35 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Struts – Faces ƒ This is an integration library to explore methods of integrating Struts with JSF. ¾ Note: At the time of this writing, this library is not current. If possible, I will include more current information and potentially an example during the week of my presentation.

Gary Ashley Jr. — Struts Roadmap Page 36 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc. Jakarta Commons – Chain of Responsibility ƒ A new commons library to support the “Chain of Responsibility” design pattern. ƒ A CoRe Request Processor is being built using this new library.

http://cvs.apache.org/viewcvs.cgi/jakarta- struts/contrib/struts-chain/README.txt

Gary Ashley Jr. — Struts Roadmap Page 37 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Jakarta Commons Resources ƒ Allows you greater flexibility in managing resource bundles. ¾Store message resources in other formats in database.

Gary Ashley Jr. — Struts Roadmap Page 38 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

What Extensions Are Available? ƒ SSL Ext ƒ Spring Framework ƒ Xdoclet ƒ AppFuse

Gary Ashley Jr. — Struts Roadmap Page 39 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Extensions? (Continued) ƒ BSF ƒ Cocoon ƒ ControlFlow ƒ Doc

Gary Ashley Jr. — Struts Roadmap Page 40 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Struts SSL Ext ƒ This extension allows you to define transmission protocol behavior. ¾i.e., which Actions require HTTPS protocol. ƒ Extends: ¾ActionConfig, RequestProcessor, Plugin ¾ and

http://struts.apache.org/faqs/ssl.html http://sslext.sourceforge.net/

Gary Ashley Jr. — Struts Roadmap Page 41 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Spring Framework Extensions ƒ IoC and AOP ¾Allows concentration on business logic development, and separates logging, auditing, … ¾http://www.springframework.org ƒ Struts package: org.springframework.web.struts • ContextLoaderPlugin • DelegatingRequestProcessor • ActionSuport, DispatchActionSupport • ActionServletAwareProcessor ƒ Made the “Struts Spring Plugin” extension obsolete.

Gary Ashley Jr. — Struts Roadmap Page 42 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

XDoclet Extensions ƒ Component Code Generation ¾Uses @javadoc attributes to provide code generation capabilities. ¾ http://xdoclet.sourceforge.net/tags/apache-tags.html ƒ Examples ¾@struts.action ¾@struts.form ¾@struts.validation

Gary Ashley Jr. — Struts Roadmap Page 43 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

AppFuse Extension ƒ Starter application that includes integration with Hibernate, DBUnit, Cactus, , and Struts ¾ http://raibledesigns.com/wiki/Wiki.jsp?page=AppFuse

Gary Ashley Jr. — Struts Roadmap Page 44 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Bean Scripting Framework Ext. ƒ Using the Jakarta BSF framework allows struts Action classes to be written in a scripting framework ¾Perl ¾Python ¾Ruby ¾JavaScript ¾BeanShell ¾VBScript (?) http://struts.sourceforge.net/struts-bsf/index.html

Gary Ashley Jr. — Struts Roadmap Page 45 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Cocoon Extensions ƒ Allows you to leverage the presentation power of the Cocoon framework. ƒ Struts ActionForwards are passed to Cocoon to be rendered as XML Pipelines. ¾See http://cocoon.apache.org for more details.

http://struts.sourceforge.net/struts-cocoon/index.html

Gary Ashley Jr. — Struts Roadmap Page 46 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Struts Flow ƒ Port of Cocoon’s ControlFlow concept. ¾Allows complex workflow using “continuations- capable” JavaScript.

http://struts.sourceforge.net/struts-flow/index.html

Gary Ashley Jr. — Struts Roadmap Page 47 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Struts Doc ƒ An Ant task to generate javadoc like documentation from the Struts config file.

http://struts.sourceforge.net/strutsdoc/index.html

Gary Ashley Jr. — Struts Roadmap Page 48 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

JAAS Techniques ƒ There is no definite JAAS resource at this time for Struts. ƒ Potential sources of further information: ¾http://www.mooreds.com/jaas.html ¾http://www.javaworld.com/javaforums/showflat. php?Cat=2&Board=JavaSecurity&Number=2500 &page=0&view=collapsed&sb=5&o=&fpart=1 ¾http://sourceforge.net/projects/jguard

Gary Ashley Jr. — Struts Roadmap Page 49 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Should I Choose Struts? ƒ Large community of support ƒ Stable and mature technology ƒ Don’t take Risk alone ƒ For a more in-depth analysis: ¾ http://www.scioworks.net/devnews/articles/struts_adoption_issues

Gary Ashley Jr. — Struts Roadmap Page 50 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc. Where Can I Find Additional Information? ƒ http://struts.apache.org ¾ Source code, binary distribution, UserGuide, Developer Guide, FAQ, Roadmap ¾ Warning: Not always very current! ƒ http://wiki.apache.org/struts/ ¾ Help wanted, NewFAQs, ShortTermPlans, Whiteboard, ReleasePlans, IdeaJar ¾ Resources • Books, articles, tools, training, weblinks ¾ Typically much more current. ƒ http://struts.sourceforge.net ¾ Extensions and examples

Gary Ashley Jr. — Struts Roadmap Page 51 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

Questions

Are there any questions?

Gary Ashley Jr. — Struts Roadmap Page 52 Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, CTA, Inc.

The End Thank you for coming!

Gary Ashley Jr. CTA, Inc. garyashley at cta dot com

Gary Ashley Jr. — Struts Roadmap Page 53