SlideShare una empresa de Scribd logo
1 de 46
Descargar para leer sin conexión
Migrating from Struts 1 to Struts 2
 Matt Raible, Virtuas Open Source Solutions
 mraible@virtuas.com




                                              © 2005-2006, Virtuas Open Source Solutions
Introductions
Your experience with Java?
Your experience with Web Frameworks?
What do you hope to learn today?
Open Source experience: Ant, Struts, WebWork,
Spring, Hibernate, Eclipse, Tomcat?
Favorite IDE? Favorite OS? Favorite Server?
Matt
Raible
Web Framework Experience
 Struts: used since June 2001 - same time 1.0 was
 released.
 Spring MVC: used since January 2004 - before 1.0
 was released.
 WebWork: used since July 2004.
 Tapestry: used since July 2004.
 JSF: used since July 2004 - both Sun’s RI and
 MyFaces.
Agenda
1. Struts Overview
2. WebWork Overview
3. Reasons for Upgrading
4. Migrating from Struts 1 to Struts 2
5. Migrating from WebWork 2 to Struts 2
6. Pitfalls
7. Q and A
Struts 1.x Overview
Struts 1.x
Pros:
   The “Standard” - lots of Struts jobs
   Lots of information and examples
   HTML tag library is one of the best
Cons:
   ActionForms - they’re a pain
   Can’t unit test - StrutsTestCase only does
   integration
   Project has been rumored as “dead”
WebWork/Struts2
WebWork/Struts 2
Pros:
   Simple architecture - easy to extend
   Tag Library is easy to customize with
   FreeMarker or Velocity
   Interceptors are pretty slick
   Controller-based or page-based navigation
Cons:
   Small Community
   Documentation is poorly organized
WebWork / Struts 2
WW/S2 Lifecycle
WebWork Action
public class UserAction extends ActionSupport {
    private UserManager mgr;
    private User user;
    private String id;

   public void setUserManager(UserManager userManager) {
       this.mgr = userManager;
   }

   public void setId(String id) {
       this.id = id;
   }

   public User getUser() {
       return user;
   }

   public String edit() {
       // check for an add
       if (id != null) {
           user = mgr.getUser(id);
       } else {
           user = new User();
       }
       return SUCCESS;
   }
WebWork Interceptors
public class ValidationInterceptor extends AroundInterceptor {

    protected void after(ActionInvocation dispatcher, String result) throws Exception {
    }

    protected void before(ActionInvocation invocation) throws Exception {
        Action action = invocation.getAction();
        String context = invocation.getProxy().getActionName();

        final Map parameters = ActionContext.getContext().getParameters();
        // don't validate on cancel, delete or GET
        if (ServletActionContext.getRequest().getMethod().equals(quot;GETquot;)) {
            log.debug(quot;Cancelling validation, detected GET requestquot;);
        } else if (parameters.containsKey(quot;cancelquot;) || parameters.containsKey(quot;deletequot;)) {
            log.debug(quot;Cancelling validation, detected clicking cancel or deletequot;);
        } else {
            ActionValidatorManager.validate(action, context);
        }
    }
}
xwork.xml
<!-- List of Users -->
<action name=quot;usersquot; class=quot;userActionquot; method=quot;listquot;>
    <result name=quot;successquot;>userList.jsp</result>
    <result name=quot;inputquot;>userList.jsp</result>
</action>

<!-- Edit User -->
<action name=quot;editUserquot; class=quot;userActionquot; method=quot;editquot;>
    <result name=quot;successquot;>userForm.jsp</result>
    <result name=quot;inputquot;>userList.jsp</result>
</action>

<!-- Save User -->
<action name=quot;saveUserquot; class=quot;userActionquot;>
    <result name=quot;cancelquot; type=quot;redirectquot;>users.html</result>
    <result name=quot;deletequot; type=quot;redirectquot;>users.html</result>
    <result name=quot;inputquot;>userForm.jsp</result>
    <result name=quot;successquot; type=quot;chainquot;>saveUserWithValidation</result>
</action>
WebWork JSP View

<ww:form name=quot;userFormquot; action=quot;saveUserquot; method=quot;postquot; validate=quot;truequot;>
    <ww:hidden name=quot;user.idquot; value=quot;%{user.id}quot;/>

    <ww:textfield label=quot;%{getText('user.firstName')}quot; name=quot;user.firstNamequot;
        value=quot;%{user.firstName}quot; id=quot;user.firstNamequot;/>

    <ww:textfield label=quot;%{getText('user.lastName')}quot; name=quot;user.lastNamequot;
        value=quot;%{user.lastName}quot; required=quot;truequot;/>

    <ww:datepicker label=quot;%{getText('user.birthday')}quot; name=quot;user.birthdayquot;
        size=quot;11quot;/>
WebWork DatePicker

<ww:form name=quot;userFormquot; action=quot;saveUserquot; method=quot;postquot; validate=quot;truequot;>
    <ww:hidden name=quot;user.idquot; value=quot;%{user.id}quot;/>

   <ww:textfield label=quot;%{getText('user.firstName')}quot; name=quot;user.firstNamequot;
       value=quot;%{user.firstName}quot; id=quot;user.firstNamequot;/>

   <ww:textfield label=quot;%{getText('user.lastName')}quot; name=quot;user.lastNamequot;
       value=quot;%{user.lastName}quot; required=quot;truequot;/>

    <ww:datepicker label=quot;%{getText('user.birthday')}quot; name=quot;user.birthdayquot;
        size=quot;11quot;/>
Page-based Navigation

<%@ include file=quot;/common/taglibs.jspquot;%>

<h2>Author Blogs</h2>

<ww:action name=quot;authorsquot; id=quot;%{authors}quot; namespace=quot;defaultquot;/>

<div class=quot;itemquot;>
    <ww:iterator value=quot;#authors.authorsquot; status=quot;indexquot;>
        <a href=quot;<ww:property value=quot;blog.feedUrlquot;/>quot;>
            <img src=quot;${ctxPath}/images/icons/xml.gifquot; alt=quot;XML Feedquot;/></a>
        <a href=quot;<ww:property value=quot;blog.urlquot;/>quot;><ww:property value=quot;namequot;/></a>
        <br />
    </ww:iterator>
</div>
OGNL
<ww:form name=quot;userFormquot; action=quot;saveUserquot; method=quot;postquot; validate=quot;truequot;>
    <ww:hidden name=quot;user.idquot; value=quot;%{user.id}quot;/>

    <ww:textfield label=quot;%{getText('user.firstName')}quot; name=quot;user.firstNamequot;
        value=quot;%{user.firstName}quot; id=quot;user.firstNamequot;/>

    <ww:textfield label=quot;%{getText('user.lastName')}quot; name=quot;user.lastNamequot;
         value=quot;%{user.lastName}quot; required=quot;truequot;/>
</tr>
    <th><label for=quot;user.birthdayquot;><fmt:message key=quot;user.birthdayquot;/>:</label></th>
    <td>
         <ww:set name=quot;birthdayquot; scope=quot;requestquot;
             value=quot;(user.birthday instanceof java.util.Date) ? user.birthday : ''quot;/>
         <input type=quot;textquot; size=quot;11quot; name=quot;user.birthdayquot; id=quot;user.birthdayquot;
             value=quot;<fmt:formatDate value=quot;${birthday}quot; pattern=quot;${datePattern}quot;/>quot;/>
             [${datePattern}]
    </td>
<tr>
Struts 1   Struts 2
Comparison
    Struts 1             Struts 2

    Action                Action

  ActionForm         Action or POJO

 ActionForward            Result

struts-config.xml        struts.xml

 ActionServlet       FilterDispatcher

RequestProcessor       Interceptors

 validation.xml    Action-validation.xml
Features only in Struts 2
Page-based Navigation
Built-in Ajax Support: DWR and Dojo
Spring as default inversion of control container
Changed from front-controller servlet to filter
Much better client-side validation support
QuickStart and Annotations
JSF Support
Built-in support for testing with StrutsTestCase
Struts Plugins
Run Struts 1.x Actions
<action name=quot;editGangsterquot;
   class=quot;org.apache.struts2.s1.Struts1Actionquot;>
  <param name=quot;classNamequot;>
     com.mycompany.gangstas.EditGangsterAction
  </param>
  <result>
     gangsterForm.jsp
  </result>
</action>
Equinox
AppFuse Light - designed for quick apps with few
requirements (i.e. prototypes)
Includes 6 MVC implementations: JSF, Spring MVC,
Struts 1, Struts 2, Tapestry and WebWork
Includes 5 Persistence frameworks: Hibernate,
iBATIS, JDO, OJB, Spring JDBC
50 combinations available!
Located at http://equinox.dev.java.net
Sample Migration
WebWork 2   Struts 2
Comparison
        WebWork 2                      Struts 2

 com.opensymphony.xwork.*    com.opensymphony.xwork2.*

com.opensymphony.webwork.*       org.apache.struts2.*

        xwork.xml                     struts.xml

    webwork.properties             struts.properties

         <ww:*/>                        <s:*/>
Sample Migration
Pitfalls and Issues
Learn more from...
Don Brown's Struts 2.0 presentation/article:
    http://us.apachecon.com/presentations/WE9/WE9-
    struts-2.0.ppt
    http://www.oreillynet.com/onjava/blog/2006/10/
    my_history_of_struts_2.html
InfoQ's Migrating to Struts 2 articles:
    http://infoq.com/articles/converting-struts-2-part1
    http://infoq.com/news/struts2-migration-part2
Questions?
Struts Project:
    http://struts.apache.org
Community:
    http://struts.apache.org/mail.html
Tutorials:
    http://cwiki.apache.org/confluence/display/
    WW/Tutorials
Kickstart your development with Equinox:
    https://equinox.dev.java.net

Más contenido relacionado

La actualidad más candente

Building Event Driven Architectures with Kafka and Cloud Events (Dan Rosanova...
Building Event Driven Architectures with Kafka and Cloud Events (Dan Rosanova...Building Event Driven Architectures with Kafka and Cloud Events (Dan Rosanova...
Building Event Driven Architectures with Kafka and Cloud Events (Dan Rosanova...confluent
 
Getting Started Monitoring with Prometheus and Grafana
Getting Started Monitoring with Prometheus and GrafanaGetting Started Monitoring with Prometheus and Grafana
Getting Started Monitoring with Prometheus and GrafanaSyah Dwi Prihatmoko
 
MuleSoft Surat Meetup#41 - Universal API Management, Anypoint Flex Gateway an...
MuleSoft Surat Meetup#41 - Universal API Management, Anypoint Flex Gateway an...MuleSoft Surat Meetup#41 - Universal API Management, Anypoint Flex Gateway an...
MuleSoft Surat Meetup#41 - Universal API Management, Anypoint Flex Gateway an...Jitendra Bafna
 
Introduction to Kong API Gateway
Introduction to Kong API GatewayIntroduction to Kong API Gateway
Introduction to Kong API GatewayYohann Ciurlik
 
Micro Front-End & Microservices - Plansoft
Micro Front-End & Microservices - PlansoftMicro Front-End & Microservices - Plansoft
Micro Front-End & Microservices - PlansoftMiki Lombardi
 
Prometheus Overview
Prometheus OverviewPrometheus Overview
Prometheus OverviewBrian Brazil
 
Server monitoring using grafana and prometheus
Server monitoring using grafana and prometheusServer monitoring using grafana and prometheus
Server monitoring using grafana and prometheusCeline George
 
Monitoring With Prometheus
Monitoring With PrometheusMonitoring With Prometheus
Monitoring With PrometheusKnoldus Inc.
 
App Modernisation with Microsoft Azure
App Modernisation with Microsoft AzureApp Modernisation with Microsoft Azure
App Modernisation with Microsoft AzureAdam Stephensen
 
Grafana optimization for Prometheus
Grafana optimization for PrometheusGrafana optimization for Prometheus
Grafana optimization for PrometheusMitsuhiro Tanda
 
Making sense of microservices, service mesh, and serverless
Making sense of microservices, service mesh, and serverlessMaking sense of microservices, service mesh, and serverless
Making sense of microservices, service mesh, and serverlessChristian Posta
 
Infrastructure & System Monitoring using Prometheus
Infrastructure & System Monitoring using PrometheusInfrastructure & System Monitoring using Prometheus
Infrastructure & System Monitoring using PrometheusMarco Pas
 
Microservices Architecture
Microservices ArchitectureMicroservices Architecture
Microservices ArchitectureMateus Prado
 
How to Get Started with DevSecOps
How to Get Started with DevSecOpsHow to Get Started with DevSecOps
How to Get Started with DevSecOpsCYBRIC
 
MuleSoft Architecture Presentation
MuleSoft Architecture PresentationMuleSoft Architecture Presentation
MuleSoft Architecture PresentationRupesh Sinha
 

La actualidad más candente (20)

Building Event Driven Architectures with Kafka and Cloud Events (Dan Rosanova...
Building Event Driven Architectures with Kafka and Cloud Events (Dan Rosanova...Building Event Driven Architectures with Kafka and Cloud Events (Dan Rosanova...
Building Event Driven Architectures with Kafka and Cloud Events (Dan Rosanova...
 
Getting Started Monitoring with Prometheus and Grafana
Getting Started Monitoring with Prometheus and GrafanaGetting Started Monitoring with Prometheus and Grafana
Getting Started Monitoring with Prometheus and Grafana
 
MuleSoft Surat Meetup#41 - Universal API Management, Anypoint Flex Gateway an...
MuleSoft Surat Meetup#41 - Universal API Management, Anypoint Flex Gateway an...MuleSoft Surat Meetup#41 - Universal API Management, Anypoint Flex Gateway an...
MuleSoft Surat Meetup#41 - Universal API Management, Anypoint Flex Gateway an...
 
Dynatrace
DynatraceDynatrace
Dynatrace
 
Introduction to Kong API Gateway
Introduction to Kong API GatewayIntroduction to Kong API Gateway
Introduction to Kong API Gateway
 
Micro Front-End & Microservices - Plansoft
Micro Front-End & Microservices - PlansoftMicro Front-End & Microservices - Plansoft
Micro Front-End & Microservices - Plansoft
 
Prometheus Overview
Prometheus OverviewPrometheus Overview
Prometheus Overview
 
Server monitoring using grafana and prometheus
Server monitoring using grafana and prometheusServer monitoring using grafana and prometheus
Server monitoring using grafana and prometheus
 
Prometheus monitoring
Prometheus monitoringPrometheus monitoring
Prometheus monitoring
 
Monitoring With Prometheus
Monitoring With PrometheusMonitoring With Prometheus
Monitoring With Prometheus
 
App Modernisation with Microsoft Azure
App Modernisation with Microsoft AzureApp Modernisation with Microsoft Azure
App Modernisation with Microsoft Azure
 
Grafana optimization for Prometheus
Grafana optimization for PrometheusGrafana optimization for Prometheus
Grafana optimization for Prometheus
 
Why to Cloud Native
Why to Cloud NativeWhy to Cloud Native
Why to Cloud Native
 
Making sense of microservices, service mesh, and serverless
Making sense of microservices, service mesh, and serverlessMaking sense of microservices, service mesh, and serverless
Making sense of microservices, service mesh, and serverless
 
Infrastructure & System Monitoring using Prometheus
Infrastructure & System Monitoring using PrometheusInfrastructure & System Monitoring using Prometheus
Infrastructure & System Monitoring using Prometheus
 
Microservices Architecture
Microservices ArchitectureMicroservices Architecture
Microservices Architecture
 
Prometheus and Grafana
Prometheus and GrafanaPrometheus and Grafana
Prometheus and Grafana
 
Azure dev ops
Azure dev opsAzure dev ops
Azure dev ops
 
How to Get Started with DevSecOps
How to Get Started with DevSecOpsHow to Get Started with DevSecOps
How to Get Started with DevSecOps
 
MuleSoft Architecture Presentation
MuleSoft Architecture PresentationMuleSoft Architecture Presentation
MuleSoft Architecture Presentation
 

Similar a Migrating from Struts 1 to Struts 2

[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)Carles Farré
 
What's Coming in Spring 3.0
What's Coming in Spring 3.0What's Coming in Spring 3.0
What's Coming in Spring 3.0Matt Raible
 
Strutsjspservlet
Strutsjspservlet Strutsjspservlet
Strutsjspservlet Sagar Nakul
 
Strutsjspservlet
Strutsjspservlet Strutsjspservlet
Strutsjspservlet Sagar Nakul
 
Introducing Struts 2
Introducing Struts 2Introducing Struts 2
Introducing Struts 2wiradikusuma
 
Strut2-Spring-Hibernate
Strut2-Spring-HibernateStrut2-Spring-Hibernate
Strut2-Spring-HibernateJay Shah
 
DWR, Hibernate and Dojo.E - A Tutorial
DWR, Hibernate and Dojo.E - A TutorialDWR, Hibernate and Dojo.E - A Tutorial
DWR, Hibernate and Dojo.E - A Tutorialjbarciauskas
 
What's new and exciting with JSF 2.0
What's new and exciting with JSF 2.0What's new and exciting with JSF 2.0
What's new and exciting with JSF 2.0Michael Fons
 
ActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group PresentationActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group Presentationipolevoy
 
Introduction to JSF
Introduction toJSFIntroduction toJSF
Introduction to JSFSoftServe
 
Struts2
Struts2Struts2
Struts2yuvalb
 
Struts 2 + Spring
Struts 2 + SpringStruts 2 + Spring
Struts 2 + SpringBryan Hsueh
 
Spring MVC
Spring MVCSpring MVC
Spring MVCyuvalb
 

Similar a Migrating from Struts 1 to Struts 2 (20)

[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
 
What's Coming in Spring 3.0
What's Coming in Spring 3.0What's Coming in Spring 3.0
What's Coming in Spring 3.0
 
Struts,Jsp,Servlet
Struts,Jsp,ServletStruts,Jsp,Servlet
Struts,Jsp,Servlet
 
Strutsjspservlet
Strutsjspservlet Strutsjspservlet
Strutsjspservlet
 
Strutsjspservlet
Strutsjspservlet Strutsjspservlet
Strutsjspservlet
 
Introducing Struts 2
Introducing Struts 2Introducing Struts 2
Introducing Struts 2
 
Retrofitting
RetrofittingRetrofitting
Retrofitting
 
Strut2-Spring-Hibernate
Strut2-Spring-HibernateStrut2-Spring-Hibernate
Strut2-Spring-Hibernate
 
Spine.js
Spine.jsSpine.js
Spine.js
 
DWR, Hibernate and Dojo.E - A Tutorial
DWR, Hibernate and Dojo.E - A TutorialDWR, Hibernate and Dojo.E - A Tutorial
DWR, Hibernate and Dojo.E - A Tutorial
 
Jsfsunum
JsfsunumJsfsunum
Jsfsunum
 
Struts Overview
Struts OverviewStruts Overview
Struts Overview
 
What's new and exciting with JSF 2.0
What's new and exciting with JSF 2.0What's new and exciting with JSF 2.0
What's new and exciting with JSF 2.0
 
ActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group PresentationActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group Presentation
 
Introduction to JSF
Introduction toJSFIntroduction toJSF
Introduction to JSF
 
Struts2.0basic
Struts2.0basicStruts2.0basic
Struts2.0basic
 
Unit 07: Design Patterns and Frameworks (3/3)
Unit 07: Design Patterns and Frameworks (3/3)Unit 07: Design Patterns and Frameworks (3/3)
Unit 07: Design Patterns and Frameworks (3/3)
 
Struts2
Struts2Struts2
Struts2
 
Struts 2 + Spring
Struts 2 + SpringStruts 2 + Spring
Struts 2 + Spring
 
Spring MVC
Spring MVCSpring MVC
Spring MVC
 

Más de Matt Raible

Keep Identities in Sync the SCIMple Way - ApacheCon NA 2022
Keep Identities in Sync the SCIMple Way - ApacheCon NA 2022Keep Identities in Sync the SCIMple Way - ApacheCon NA 2022
Keep Identities in Sync the SCIMple Way - ApacheCon NA 2022Matt Raible
 
Micro Frontends for Java Microservices - Belfast JUG 2022
Micro Frontends for Java Microservices - Belfast JUG 2022Micro Frontends for Java Microservices - Belfast JUG 2022
Micro Frontends for Java Microservices - Belfast JUG 2022Matt Raible
 
Micro Frontends for Java Microservices - Dublin JUG 2022
Micro Frontends for Java Microservices - Dublin JUG 2022Micro Frontends for Java Microservices - Dublin JUG 2022
Micro Frontends for Java Microservices - Dublin JUG 2022Matt Raible
 
Micro Frontends for Java Microservices - Cork JUG 2022
Micro Frontends for Java Microservices - Cork JUG 2022Micro Frontends for Java Microservices - Cork JUG 2022
Micro Frontends for Java Microservices - Cork JUG 2022Matt Raible
 
Comparing Native Java REST API Frameworks - Seattle JUG 2022
Comparing Native Java REST API Frameworks - Seattle JUG 2022Comparing Native Java REST API Frameworks - Seattle JUG 2022
Comparing Native Java REST API Frameworks - Seattle JUG 2022Matt Raible
 
Reactive Java Microservices with Spring Boot and JHipster - Spring I/O 2022
Reactive Java Microservices with Spring Boot and JHipster - Spring I/O 2022Reactive Java Microservices with Spring Boot and JHipster - Spring I/O 2022
Reactive Java Microservices with Spring Boot and JHipster - Spring I/O 2022Matt Raible
 
Comparing Native Java REST API Frameworks - Devoxx France 2022
Comparing Native Java REST API Frameworks - Devoxx France 2022Comparing Native Java REST API Frameworks - Devoxx France 2022
Comparing Native Java REST API Frameworks - Devoxx France 2022Matt Raible
 
Lock That Sh*t Down! Auth Security Patterns for Apps, APIs, and Infra - Devne...
Lock That Sh*t Down! Auth Security Patterns for Apps, APIs, and Infra - Devne...Lock That Sh*t Down! Auth Security Patterns for Apps, APIs, and Infra - Devne...
Lock That Sh*t Down! Auth Security Patterns for Apps, APIs, and Infra - Devne...Matt Raible
 
Native Java with Spring Boot and JHipster - Garden State JUG 2021
Native Java with Spring Boot and JHipster - Garden State JUG 2021Native Java with Spring Boot and JHipster - Garden State JUG 2021
Native Java with Spring Boot and JHipster - Garden State JUG 2021Matt Raible
 
Java REST API Framework Comparison - PWX 2021
Java REST API Framework Comparison - PWX 2021Java REST API Framework Comparison - PWX 2021
Java REST API Framework Comparison - PWX 2021Matt Raible
 
Web App Security for Java Developers - PWX 2021
Web App Security for Java Developers - PWX 2021Web App Security for Java Developers - PWX 2021
Web App Security for Java Developers - PWX 2021Matt Raible
 
Mobile App Development with Ionic, React Native, and JHipster - Connect.Tech ...
Mobile App Development with Ionic, React Native, and JHipster - Connect.Tech ...Mobile App Development with Ionic, React Native, and JHipster - Connect.Tech ...
Mobile App Development with Ionic, React Native, and JHipster - Connect.Tech ...Matt Raible
 
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Joker...
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Joker...Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Joker...
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Joker...Matt Raible
 
Web App Security for Java Developers - UberConf 2021
Web App Security for Java Developers - UberConf 2021Web App Security for Java Developers - UberConf 2021
Web App Security for Java Developers - UberConf 2021Matt Raible
 
Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021Matt Raible
 
Native Java with Spring Boot and JHipster - SF JUG 2021
Native Java with Spring Boot and JHipster - SF JUG 2021Native Java with Spring Boot and JHipster - SF JUG 2021
Native Java with Spring Boot and JHipster - SF JUG 2021Matt Raible
 
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...Matt Raible
 
Reactive Java Microservices with Spring Boot and JHipster - Denver JUG 2021
Reactive Java Microservices with Spring Boot and JHipster - Denver JUG 2021Reactive Java Microservices with Spring Boot and JHipster - Denver JUG 2021
Reactive Java Microservices with Spring Boot and JHipster - Denver JUG 2021Matt Raible
 
Get Hip with JHipster - Colorado Springs Open Source User Group 2021
Get Hip with JHipster - Colorado Springs Open Source User Group 2021Get Hip with JHipster - Colorado Springs Open Source User Group 2021
Get Hip with JHipster - Colorado Springs Open Source User Group 2021Matt Raible
 
JHipster and Okta - JHipster Virtual Meetup December 2020
JHipster and Okta - JHipster Virtual Meetup December 2020JHipster and Okta - JHipster Virtual Meetup December 2020
JHipster and Okta - JHipster Virtual Meetup December 2020Matt Raible
 

Más de Matt Raible (20)

Keep Identities in Sync the SCIMple Way - ApacheCon NA 2022
Keep Identities in Sync the SCIMple Way - ApacheCon NA 2022Keep Identities in Sync the SCIMple Way - ApacheCon NA 2022
Keep Identities in Sync the SCIMple Way - ApacheCon NA 2022
 
Micro Frontends for Java Microservices - Belfast JUG 2022
Micro Frontends for Java Microservices - Belfast JUG 2022Micro Frontends for Java Microservices - Belfast JUG 2022
Micro Frontends for Java Microservices - Belfast JUG 2022
 
Micro Frontends for Java Microservices - Dublin JUG 2022
Micro Frontends for Java Microservices - Dublin JUG 2022Micro Frontends for Java Microservices - Dublin JUG 2022
Micro Frontends for Java Microservices - Dublin JUG 2022
 
Micro Frontends for Java Microservices - Cork JUG 2022
Micro Frontends for Java Microservices - Cork JUG 2022Micro Frontends for Java Microservices - Cork JUG 2022
Micro Frontends for Java Microservices - Cork JUG 2022
 
Comparing Native Java REST API Frameworks - Seattle JUG 2022
Comparing Native Java REST API Frameworks - Seattle JUG 2022Comparing Native Java REST API Frameworks - Seattle JUG 2022
Comparing Native Java REST API Frameworks - Seattle JUG 2022
 
Reactive Java Microservices with Spring Boot and JHipster - Spring I/O 2022
Reactive Java Microservices with Spring Boot and JHipster - Spring I/O 2022Reactive Java Microservices with Spring Boot and JHipster - Spring I/O 2022
Reactive Java Microservices with Spring Boot and JHipster - Spring I/O 2022
 
Comparing Native Java REST API Frameworks - Devoxx France 2022
Comparing Native Java REST API Frameworks - Devoxx France 2022Comparing Native Java REST API Frameworks - Devoxx France 2022
Comparing Native Java REST API Frameworks - Devoxx France 2022
 
Lock That Sh*t Down! Auth Security Patterns for Apps, APIs, and Infra - Devne...
Lock That Sh*t Down! Auth Security Patterns for Apps, APIs, and Infra - Devne...Lock That Sh*t Down! Auth Security Patterns for Apps, APIs, and Infra - Devne...
Lock That Sh*t Down! Auth Security Patterns for Apps, APIs, and Infra - Devne...
 
Native Java with Spring Boot and JHipster - Garden State JUG 2021
Native Java with Spring Boot and JHipster - Garden State JUG 2021Native Java with Spring Boot and JHipster - Garden State JUG 2021
Native Java with Spring Boot and JHipster - Garden State JUG 2021
 
Java REST API Framework Comparison - PWX 2021
Java REST API Framework Comparison - PWX 2021Java REST API Framework Comparison - PWX 2021
Java REST API Framework Comparison - PWX 2021
 
Web App Security for Java Developers - PWX 2021
Web App Security for Java Developers - PWX 2021Web App Security for Java Developers - PWX 2021
Web App Security for Java Developers - PWX 2021
 
Mobile App Development with Ionic, React Native, and JHipster - Connect.Tech ...
Mobile App Development with Ionic, React Native, and JHipster - Connect.Tech ...Mobile App Development with Ionic, React Native, and JHipster - Connect.Tech ...
Mobile App Development with Ionic, React Native, and JHipster - Connect.Tech ...
 
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Joker...
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Joker...Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Joker...
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Joker...
 
Web App Security for Java Developers - UberConf 2021
Web App Security for Java Developers - UberConf 2021Web App Security for Java Developers - UberConf 2021
Web App Security for Java Developers - UberConf 2021
 
Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021
 
Native Java with Spring Boot and JHipster - SF JUG 2021
Native Java with Spring Boot and JHipster - SF JUG 2021Native Java with Spring Boot and JHipster - SF JUG 2021
Native Java with Spring Boot and JHipster - SF JUG 2021
 
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...
 
Reactive Java Microservices with Spring Boot and JHipster - Denver JUG 2021
Reactive Java Microservices with Spring Boot and JHipster - Denver JUG 2021Reactive Java Microservices with Spring Boot and JHipster - Denver JUG 2021
Reactive Java Microservices with Spring Boot and JHipster - Denver JUG 2021
 
Get Hip with JHipster - Colorado Springs Open Source User Group 2021
Get Hip with JHipster - Colorado Springs Open Source User Group 2021Get Hip with JHipster - Colorado Springs Open Source User Group 2021
Get Hip with JHipster - Colorado Springs Open Source User Group 2021
 
JHipster and Okta - JHipster Virtual Meetup December 2020
JHipster and Okta - JHipster Virtual Meetup December 2020JHipster and Okta - JHipster Virtual Meetup December 2020
JHipster and Okta - JHipster Virtual Meetup December 2020
 

Último

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 

Último (20)

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Migrating from Struts 1 to Struts 2

  • 1. Migrating from Struts 1 to Struts 2 Matt Raible, Virtuas Open Source Solutions mraible@virtuas.com © 2005-2006, Virtuas Open Source Solutions
  • 2. Introductions Your experience with Java? Your experience with Web Frameworks? What do you hope to learn today? Open Source experience: Ant, Struts, WebWork, Spring, Hibernate, Eclipse, Tomcat? Favorite IDE? Favorite OS? Favorite Server?
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19. Web Framework Experience Struts: used since June 2001 - same time 1.0 was released. Spring MVC: used since January 2004 - before 1.0 was released. WebWork: used since July 2004. Tapestry: used since July 2004. JSF: used since July 2004 - both Sun’s RI and MyFaces.
  • 20. Agenda 1. Struts Overview 2. WebWork Overview 3. Reasons for Upgrading 4. Migrating from Struts 1 to Struts 2 5. Migrating from WebWork 2 to Struts 2 6. Pitfalls 7. Q and A
  • 22. Struts 1.x Pros: The “Standard” - lots of Struts jobs Lots of information and examples HTML tag library is one of the best Cons: ActionForms - they’re a pain Can’t unit test - StrutsTestCase only does integration Project has been rumored as “dead”
  • 24. WebWork/Struts 2 Pros: Simple architecture - easy to extend Tag Library is easy to customize with FreeMarker or Velocity Interceptors are pretty slick Controller-based or page-based navigation Cons: Small Community Documentation is poorly organized
  • 27. WebWork Action public class UserAction extends ActionSupport { private UserManager mgr; private User user; private String id; public void setUserManager(UserManager userManager) { this.mgr = userManager; } public void setId(String id) { this.id = id; } public User getUser() { return user; } public String edit() { // check for an add if (id != null) { user = mgr.getUser(id); } else { user = new User(); } return SUCCESS; }
  • 28. WebWork Interceptors public class ValidationInterceptor extends AroundInterceptor { protected void after(ActionInvocation dispatcher, String result) throws Exception { } protected void before(ActionInvocation invocation) throws Exception { Action action = invocation.getAction(); String context = invocation.getProxy().getActionName(); final Map parameters = ActionContext.getContext().getParameters(); // don't validate on cancel, delete or GET if (ServletActionContext.getRequest().getMethod().equals(quot;GETquot;)) { log.debug(quot;Cancelling validation, detected GET requestquot;); } else if (parameters.containsKey(quot;cancelquot;) || parameters.containsKey(quot;deletequot;)) { log.debug(quot;Cancelling validation, detected clicking cancel or deletequot;); } else { ActionValidatorManager.validate(action, context); } } }
  • 29. xwork.xml <!-- List of Users --> <action name=quot;usersquot; class=quot;userActionquot; method=quot;listquot;> <result name=quot;successquot;>userList.jsp</result> <result name=quot;inputquot;>userList.jsp</result> </action> <!-- Edit User --> <action name=quot;editUserquot; class=quot;userActionquot; method=quot;editquot;> <result name=quot;successquot;>userForm.jsp</result> <result name=quot;inputquot;>userList.jsp</result> </action> <!-- Save User --> <action name=quot;saveUserquot; class=quot;userActionquot;> <result name=quot;cancelquot; type=quot;redirectquot;>users.html</result> <result name=quot;deletequot; type=quot;redirectquot;>users.html</result> <result name=quot;inputquot;>userForm.jsp</result> <result name=quot;successquot; type=quot;chainquot;>saveUserWithValidation</result> </action>
  • 30. WebWork JSP View <ww:form name=quot;userFormquot; action=quot;saveUserquot; method=quot;postquot; validate=quot;truequot;> <ww:hidden name=quot;user.idquot; value=quot;%{user.id}quot;/> <ww:textfield label=quot;%{getText('user.firstName')}quot; name=quot;user.firstNamequot; value=quot;%{user.firstName}quot; id=quot;user.firstNamequot;/> <ww:textfield label=quot;%{getText('user.lastName')}quot; name=quot;user.lastNamequot; value=quot;%{user.lastName}quot; required=quot;truequot;/> <ww:datepicker label=quot;%{getText('user.birthday')}quot; name=quot;user.birthdayquot; size=quot;11quot;/>
  • 31. WebWork DatePicker <ww:form name=quot;userFormquot; action=quot;saveUserquot; method=quot;postquot; validate=quot;truequot;> <ww:hidden name=quot;user.idquot; value=quot;%{user.id}quot;/> <ww:textfield label=quot;%{getText('user.firstName')}quot; name=quot;user.firstNamequot; value=quot;%{user.firstName}quot; id=quot;user.firstNamequot;/> <ww:textfield label=quot;%{getText('user.lastName')}quot; name=quot;user.lastNamequot; value=quot;%{user.lastName}quot; required=quot;truequot;/> <ww:datepicker label=quot;%{getText('user.birthday')}quot; name=quot;user.birthdayquot; size=quot;11quot;/>
  • 32. Page-based Navigation <%@ include file=quot;/common/taglibs.jspquot;%> <h2>Author Blogs</h2> <ww:action name=quot;authorsquot; id=quot;%{authors}quot; namespace=quot;defaultquot;/> <div class=quot;itemquot;> <ww:iterator value=quot;#authors.authorsquot; status=quot;indexquot;> <a href=quot;<ww:property value=quot;blog.feedUrlquot;/>quot;> <img src=quot;${ctxPath}/images/icons/xml.gifquot; alt=quot;XML Feedquot;/></a> <a href=quot;<ww:property value=quot;blog.urlquot;/>quot;><ww:property value=quot;namequot;/></a> <br /> </ww:iterator> </div>
  • 33. OGNL <ww:form name=quot;userFormquot; action=quot;saveUserquot; method=quot;postquot; validate=quot;truequot;> <ww:hidden name=quot;user.idquot; value=quot;%{user.id}quot;/> <ww:textfield label=quot;%{getText('user.firstName')}quot; name=quot;user.firstNamequot; value=quot;%{user.firstName}quot; id=quot;user.firstNamequot;/> <ww:textfield label=quot;%{getText('user.lastName')}quot; name=quot;user.lastNamequot; value=quot;%{user.lastName}quot; required=quot;truequot;/> </tr> <th><label for=quot;user.birthdayquot;><fmt:message key=quot;user.birthdayquot;/>:</label></th> <td> <ww:set name=quot;birthdayquot; scope=quot;requestquot; value=quot;(user.birthday instanceof java.util.Date) ? user.birthday : ''quot;/> <input type=quot;textquot; size=quot;11quot; name=quot;user.birthdayquot; id=quot;user.birthdayquot; value=quot;<fmt:formatDate value=quot;${birthday}quot; pattern=quot;${datePattern}quot;/>quot;/> [${datePattern}] </td> <tr>
  • 34. Struts 1 Struts 2
  • 35. Comparison Struts 1 Struts 2 Action Action ActionForm Action or POJO ActionForward Result struts-config.xml struts.xml ActionServlet FilterDispatcher RequestProcessor Interceptors validation.xml Action-validation.xml
  • 36. Features only in Struts 2 Page-based Navigation Built-in Ajax Support: DWR and Dojo Spring as default inversion of control container Changed from front-controller servlet to filter Much better client-side validation support QuickStart and Annotations JSF Support Built-in support for testing with StrutsTestCase
  • 38. Run Struts 1.x Actions <action name=quot;editGangsterquot; class=quot;org.apache.struts2.s1.Struts1Actionquot;> <param name=quot;classNamequot;> com.mycompany.gangstas.EditGangsterAction </param> <result> gangsterForm.jsp </result> </action>
  • 39. Equinox AppFuse Light - designed for quick apps with few requirements (i.e. prototypes) Includes 6 MVC implementations: JSF, Spring MVC, Struts 1, Struts 2, Tapestry and WebWork Includes 5 Persistence frameworks: Hibernate, iBATIS, JDO, OJB, Spring JDBC 50 combinations available! Located at http://equinox.dev.java.net
  • 41. WebWork 2 Struts 2
  • 42. Comparison WebWork 2 Struts 2 com.opensymphony.xwork.* com.opensymphony.xwork2.* com.opensymphony.webwork.* org.apache.struts2.* xwork.xml struts.xml webwork.properties struts.properties <ww:*/> <s:*/>
  • 45. Learn more from... Don Brown's Struts 2.0 presentation/article: http://us.apachecon.com/presentations/WE9/WE9- struts-2.0.ppt http://www.oreillynet.com/onjava/blog/2006/10/ my_history_of_struts_2.html InfoQ's Migrating to Struts 2 articles: http://infoq.com/articles/converting-struts-2-part1 http://infoq.com/news/struts2-migration-part2
  • 46. Questions? Struts Project: http://struts.apache.org Community: http://struts.apache.org/mail.html Tutorials: http://cwiki.apache.org/confluence/display/ WW/Tutorials Kickstart your development with Equinox: https://equinox.dev.java.net