Migrating to Struts 2A tutorial for Struts 1 Developers                    Struts University Series
Migrating to Struts 2A tutorial for Struts 1 Developers                    Struts University Series
Ted? Whos Ted?Apache Software Foundation MemberApache Struts & Apache iBATIS PMCsJUnit in Action, Struts in Action, andPro...
Ted? Whos Ted?Apache Software Foundation MemberApache Struts & Apache iBATIS PMCsJUnit in Action, Struts in Action, andPro...
Ted? Whos Ted?Apache Software Foundation MemberApache Struts & Apache iBATIS PMCsJUnit in Action, Struts in Action, andPro...
Ted? Whos Ted?Apache Software Foundation MemberApache Struts & Apache iBATIS PMCsJUnit in Action, Struts in Action, andPro...
Ted? Whos Ted?Apache Software Foundation MemberApache Struts & Apache iBATIS PMCsJUnit in Action, Struts in Action, andPro...
Ted? Whos Ted?Apache Software Foundation MemberApache Struts & Apache iBATIS PMCsJUnit in Action, Struts in Action, andPro...
Migrating to Struts 2Help Struts 1 developers becomeknowledgeable Struts 2 developers asquickly as possibleMigrate Struts ...
Migrating to Struts 2Help Struts 1 developers becomeknowledgeable Struts 2 developers asquickly as possibleMigrate Struts ...
Migrating to Struts 2Help Struts 1 developers becomeknowledgeable Struts 2 developers asquickly as possibleMigrate Struts ...
Migrating to Struts 2Help Struts 1 developers becomeknowledgeable Struts 2 developers asquickly as possibleMigrate Struts ...
Baseline QuestionsWhat is Struts 2?How are Struts 1 and Struts alike?Whats changed in Struts 2?Is Struts 1 obsolete?Is it ...
Baseline QuestionsWhat is Struts 2?How are Struts 1 and Struts alike?Whats changed in Struts 2?Is Struts 1 obsolete?Is it ...
Baseline QuestionsWhat is Struts 2?How are Struts 1 and Struts alike?Whats changed in Struts 2?Is Struts 1 obsolete?Is it ...
Baseline QuestionsWhat is Struts 2?How are Struts 1 and Struts alike?Whats changed in Struts 2?Is Struts 1 obsolete?Is it ...
Baseline QuestionsWhat is Struts 2?How are Struts 1 and Struts alike?Whats changed in Struts 2?Is Struts 1 obsolete?Is it ...
Baseline QuestionsWhat is Struts 2?How are Struts 1 and Struts alike?Whats changed in Struts 2?Is Struts 1 obsolete?Is it ...
Baseline QuestionsWhat is Struts 2?How are Struts 1 and Struts alike?Whats changed in Struts 2?Is Struts 1 obsolete?Is it ...
Baseline QuestionsWhat is Struts 2?How are Struts 1 and Struts alike?Whats changed in Struts 2?Is Struts 1 obsolete?Is it ...
What is Struts 2?Free open-source framework   Two major versionsStruts 1   Proven solution to common problemsStruts 2  ...
What is Struts 2?Free open-source framework   Two major versionsStruts 1   Proven solution to common problemsStruts 2  ...
What is Struts 2?Free open-source framework   Two major versionsStruts 1   Proven solution to common problemsStruts 2  ...
What is Struts 2?Free open-source framework   Two major versionsStruts 1   Proven solution to common problemsStruts 2  ...
How are Struts 1 and Struts 2 alike?A "request" handler    maps Java classes to web application URIsA "response" handler ...
How are Struts 1 and Struts 2 alike?A "request" handler    maps Java classes to web application URIsA "response" handler ...
How are Struts 1 and Struts 2 alike?A "request" handler    maps Java classes to web application URIsA "response" handler ...
How are Struts 1 and Struts 2 alike?A "request" handler    maps Java classes to web application URIsA "response" handler ...
Whats changed in Struts 2?Smarter! Improved Design Intelligent Defaults Enhanced Results Enhanced Tags First-class AJ...
Whats changed in Struts 2?Smarter! Improved Design Intelligent Defaults Enhanced Results Enhanced Tags First-class AJ...
Whats changed in Struts 2?Smarter! Improved Design Intelligent Defaults Enhanced Results Enhanced Tags First-class AJ...
Whats changed in Struts 2?Smarter! Improved Design Intelligent Defaults Enhanced Results Enhanced Tags First-class AJ...
Whats changed in Struts 2?Smarter! Improved Design Intelligent Defaults Enhanced Results Enhanced Tags First-class AJ...
Whats changed in Struts 2?Smarter! Improved Design Intelligent Defaults Enhanced Results Enhanced Tags First-class AJ...
Whats changed in Struts 2?Smarter! Improved Design Intelligent Defaults Enhanced Results Enhanced Tags First-class AJ...
Whats changed in Struts 2?Smarter! Improved Design Intelligent Defaults Enhanced Results Enhanced Tags First-class AJ...
Whats changed in Struts 2?Smarter! Improved Design Intelligent Defaults Enhanced Results Enhanced Tags First-class AJ...
Whats Changed in Struts 2?Easier! Easy-to-test Actions Easy-to-customize controller Easy-to-tweak tags Easy cancel han...
Whats Changed in Struts 2?Easier! Easy-to-test Actions Easy-to-customize controller Easy-to-tweak tags Easy cancel han...
Whats Changed in Struts 2?Easier! Easy-to-test Actions Easy-to-customize controller Easy-to-tweak tags Easy cancel han...
Whats Changed in Struts 2?Easier! Easy-to-test Actions Easy-to-customize controller Easy-to-tweak tags Easy cancel han...
Whats Changed in Struts 2?Easier! Easy-to-test Actions Easy-to-customize controller Easy-to-tweak tags Easy cancel han...
Whats Changed in Struts 2?Easier! Easy-to-test Actions Easy-to-customize controller Easy-to-tweak tags Easy cancel han...
Whats Changed in Struts 2?Easier! Easy-to-test Actions Easy-to-customize controller Easy-to-tweak tags Easy cancel han...
Whats Changed in Struts 2POJO-ier! POJO forms POJO Actions
Whats Changed in Struts 2POJO-ier! POJO forms POJO Actions
Whats Changed in Struts 2POJO-ier! POJO forms POJO Actions
Is Struts 1 obsolete?Robust and vibrant communityThousands of applications in productionNew 1.3.5 releaseBut, is it time t...
Is Struts 1 obsolete?Robust and vibrant communityThousands of applications in productionNew 1.3.5 releaseBut, is it time t...
Is Struts 1 obsolete?Robust and vibrant communityThousands of applications in productionNew 1.3.5 releaseBut, is it time t...
Is Struts 1 obsolete?Robust and vibrant communityThousands of applications in productionNew 1.3.5 releaseBut, is it time t...
Is Struts 1 obsolete?Robust and vibrant communityThousands of applications in productionNew 1.3.5 releaseBut, is it time t...
Is it difficult to migrate?Not difficult but non-trivialMigrating Actions takes time and effortStable: may not be worth th...
Is it difficult to migrate?Not difficult but non-trivialMigrating Actions takes time and effortStable: may not be worth th...
Is it difficult to migrate?Not difficult but non-trivialMigrating Actions takes time and effortStable: may not be worth th...
Is it difficult to migrate?Not difficult but non-trivialMigrating Actions takes time and effortStable: may not be worth th...
Is it difficult to migrate?Not difficult but non-trivialMigrating Actions takes time and effortStable: may not be worth th...
Is it difficult to migrate?Not difficult but non-trivialMigrating Actions takes time and effortStable: may not be worth th...
Is it difficult to migrate?Not difficult but non-trivialMigrating Actions takes time and effortStable: may not be worth th...
Why are POJOs important?No "extra" objects   Instantiate Actions with new or Spring   Simulate servlet state with HashMa...
Why are POJOs important?No "extra" objects   Instantiate Actions with new or Spring   Simulate servlet state with HashMa...
Why are POJOs important?No "extra" objects   Instantiate Actions with new or Spring   Simulate servlet state with HashMa...
Struts University Series
How are Struts 1 and Struts 2 alike?A "r******" handler    maps Java classes to web application URIsA "r*******" handler ...
How are Struts 1 and Struts 2 alike?A "request" handler    maps Java classes to web application URIsA "r*******" handler ...
How are Struts 1 and Struts 2 alike?A "request" handler    maps Java classes to web application URIsA "response" handler ...
How are Struts 1 and Struts 2 alike?A "request" handler    maps Java classes to web application URIsA "response" handler ...
How are Struts 1 and Struts 2 alike?A "request" handler    maps Java classes to web application URIsA "response" handler ...
Where should a migration begin?Add Struts 2 JARsMigrate application page at a timeUse both versions at the same timeArchit...
Where should a migration begin?Add Struts 2 JARsMigrate application page at a timeUse both versions at the same timeArchit...
Where should a migration begin?Add Struts 2 JARsMigrate application page at a timeUse both versions at the same timeArchit...
Where should a migration begin?Add Struts 2 JARsMigrate application page at a timeUse both versions at the same timeArchit...
Where should a migration begin?Add Struts 2 JARsMigrate application page at a timeUse both versions at the same timeArchit...
Where should a migration begin?Add Struts 2 JARsMigrate application page at a timeUse both versions at the same timeArchit...
Where should a migration begin?Add Struts 2 JARsMigrate application page at a timeUse both versions at the same timeArchit...
Where should a migration begin?Migrate "Hello World" applicationDisplays message in two languagesAdd input form for custom...
Where should a migration begin?Migrate "Hello World" applicationDisplays message in two languagesAdd input form for custom...
Where should a migration begin?Migrate "Hello World" applicationDisplays message in two languagesAdd input form for custom...
Where should a migration begin?Migrate "Hello World" applicationDisplays message in two languagesAdd input form for custom...
Where should a migration begin?Update web.xml to add ...1)The Struts 2 Filter2)A filter mapping3)The Spring Listener
Where should a migration begin?Update web.xml to add ...1)The Struts 2 Filter2)A filter mapping3)The Spring Listener
Where should a migration begin?Update web.xml to add ...1)The Struts 2 Filter2)A filter mapping3)The Spring Listener
Where should a migration begin?Update web.xml to add ...1)The Struts 2 Filter2)A filter mapping3)The Spring Listener
Where should a migration begin?Update web.xml to add ...1)The Struts 2 Filter2)A filter mapping3)The Spring Listener
<web-app>  <!-- Struts 2 -->  <filter>    <filter-name>struts2</filter-name>    <filter-class>      org.apache.struts2.dis...
<!-- Struts 1 --><servlet>  <servlet-name>action</servlet-name>  <servlet-class>    org.apache.struts.action.ActionServlet...
<!-- Either version -->  <welcome-file-list>    <welcome-file>index.html</welcome-file>  </welcome-file-list></web-app>
applicationContext.xml<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE beans PUBLIC    "-//SPRING//DTD BEAN//EN"    "http:/...
Lets code it!
Where should a migration begin?Struts 1 actions handle *.doStruts 2 actions handle *.actionMigrate one to the other,until ...
Where should a migration begin?Struts 1 actions handle *.doStruts 2 actions handle *.actionMigrate one to the other,until ...
Where should a migration begin?Struts 1 actions handle *.doStruts 2 actions handle *.actionMigrate one to the other,until ...
Where should a migration begin?Struts 1 actions handle *.doStruts 2 actions handle *.actionMigrate one to the other,until ...
Struts University Series
Where should a migration begin?For dependency injection, by default,Struts 2 uses HiveMind Spring Castle Pico
Where should a migration begin?For dependency injection, by default,Struts 2 uses HiveMind Spring Castle Pico
Where should a migration begin?Update web.xml to add ... The Struts 2 ****** A filter ******* The ****** Listener
Where should a migration begin?Update web.xml to add ... The Struts 2 ****** A filter ******* The ****** Listener
Where should a migration begin?Update web.xml to add ... The Struts 2 Filter A filter ******* The ****** Listener
Where should a migration begin?Update web.xml to add ... The Struts 2 Filter A filter mapping The ****** Listener
Where should a migration begin?Update web.xml to add ... The Struts 2 Filter A filter mapping The Spring Listener
Where should a migration begin?Update web.xml to add ... The Struts 2 Filter A filter mapping The Spring Listener
Is the Struts 2 configuration file different? Struts 2 configuration file is streamlined Less to configure Element names a...
Is the Struts 2 configuration file different? Struts 2 configuration file is streamlined Less to configure Element names a...
Is the Struts 2 configuration file different? Struts 2 configuration file is streamlined Less to configure Element names a...
Is the Struts 2 configuration file different? Struts 2 configuration file is streamlined Less to configure Element names a...
Is the Struts 2 configuration file different? Struts 2 configuration file is streamlined Less to configure Element names a...
Is the Struts 2 configuration file different? Struts 2 configuration file is streamlined Less to configure Element names a...
<?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE struts-config PUBLIC  "-//Apache Software Foundation//DTD  Struts Co...
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE struts PUBLIC  "-//Apache Software Foundation//DTD  Struts Configuration ...
Lets code it!
To migrate configurationReplace the DTDChange <struts-config> to <struts>Add <include file="struts-default.xml"/>Remove th...
To migrate configurationReplace the DTDChange <struts-config> to <struts>Add <include file="struts-default.xml"/>Remove th...
To migrate configurationReplace the DTDChange <struts-config> to <struts>Add <include file="struts-default.xml"/>Remove th...
To migrate configurationReplace the DTDChange <struts-config> to <struts>Add <include file="struts-default.xml"/>Remove th...
To migrate configurationReplace the DTDChange <struts-config> to <struts>Add <include file="struts-default.xml"/>Remove th...
To migrate configurationReplace the DTDChange <struts-config> to <struts>Add <include file="struts-default.xml"/>Remove th...
To migrate configurationReplace the DTDChange <struts-config> to <struts>Add <include file="struts-default.xml"/>Remove th...
To migrate configurationTo update each <action> element, we1)Remove from <action> the "name" attribute2)Change the <action...
To migrate configurationTo update each <action> element, we1)Remove from <action> the "name" attribute2)Change the <action...
To migrate configurationTo update each <action> element, we1)Remove from <action> the "name" attribute2)Change the <action...
To migrate configurationTo update each <action> element, we1)Remove from <action> the "name" attribute2)Change the <action...
Struts University Series
Is the Struts 2 configuration file different? Struts 2 configuration file is (less/more) to configure Struts 2 configurati...
Is the Struts 2 configuration file different? Struts 2 configuration file is (less/more) to configure Struts 2 configurati...
Is the Struts 2 configuration file different? Struts 2 configuration file is (less/more) to configure Struts 2 configurati...
Is the Struts 2 configuration file different? Struts 2 configuration file is (less/more) to configure Struts 2 configurati...
Is the Struts 2 configuration file different? Struts 2 configuration file is (less/more) to configure Struts 2 configurati...
To migrate configurationReplace the DTD****** <struts-config> to <struts>Add <include file="struts-default.xml"/>****** th...
To migrate configurationReplace the DTDChange <struts-config> to <struts>Add <include file="struts-default.xml"/>****** th...
To migrate configurationReplace the DTDChange <struts-config> to <struts>Add <include file="struts-default.xml"/>Remove th...
To migrate configurationReplace the DTDChange <struts-config> to <struts>Add <include file="struts-default.xml"/>Remove th...
To migrate configurationReplace the DTDChange <struts-config> to <struts>Add <include file="struts-default.xml"/>Remove th...
Why so many changes?Obsolesce   We just plain dont need them anymoreConsistency   Attribute names are applied consistent...
Why so many changes?Obsolesce   We just plain dont need them anymoreConsistency   Attribute names are applied consistent...
Why so many changes?Obsolesce   We just plain dont need them anymoreConsistency   Attribute names are applied consistent...
Why so many changes?Obsolesce   We just plain dont need them anymoreConsistency   Attribute names are applied consistent...
Intelligent DefaultsWhen an essential value is omitted, the system automatically provides  a predefined value, eliminati...
Intelligent DefaultsWhen an essential value is omitted, the system automatically provides  a predefined value, eliminati...
Intelligent DefaultsWhen an essential value is omitted, the system automatically provides  a predefined value, eliminati...
Intelligent DefaultsWhen an essential value is omitted, the system automatically provides  a predefined value, eliminati...
Intelligent Defaults<forward name="success" path="/Hello.jsp"/><result>/Hello.jsp</result>  The <result> name defaults to ...
Intelligent Defaults<forward name="success" path="/Hello.jsp"/><result>/Hello.jsp</result>  The <result> name defaults to ...
Intelligent Defaults<forward name="success" path="/Hello.jsp"/><result>/Hello.jsp</result>  The <result> name defaults to ...
Intelligent Defaults<result name="cancel" type="redirect"> /Welcome.jsp</result>  Changing the result name and type
Struts University Series
Why so many changes?O********   We just plain dont need them anymoreC**********   Attribute names are uniformC**********...
Why so many changes?Obsolesce   We just plain dont need them anymoreC**********   Attribute names are uniformC**********...
Why so many changes?Obsolesce   We just plain dont need them anymoreConsistency   Attribute names are uniformC**********...
Why so many changes?Obsolesce   We just plain dont need them anymoreConsistency   Attribute names are uniformComprehensi...
Why so many changes?Obsolesce   We just plain dont need them anymoreConsistency   Attribute names are uniformComprehensi...
Intelligent DefaultsWhen an ********* value is omitted, the system automatically provides  a ********** value, eliminati...
Intelligent DefaultsWhen an essential value is omitted, the system automatically provides  a ********** value, eliminati...
Intelligent DefaultsWhen an essential value is omitted, the system automatically provides  a predefined value, eliminati...
Intelligent DefaultsWhen an essential value is omitted, the system automatically provides  a predefined value, eliminati...
Do Action classes change too? Mostly simpler Can combine Struts 1 ActionForm,  Add input properties directly to Action  ...
Do Action classes change too? Mostly simpler Can combine Struts 1 ActionForm,  Add input properties directly to Action  ...
Do Action classes change too? Mostly simpler Can combine Struts 1 ActionForm,  Add input properties directly to Action  ...
package forms;import org.apache.struts.action.ActionForm;public class HelloForm extends ValidatorForm {    private String ...
package actions;import javax.servlet.http.*;import org.apache.struts.action.*;public class HelloAction extends Action {   ...
package actions;import com.opensymphony.xwork2.ActionSupport;public class Hello extends ActionSupport {    public String e...
Lets code it!
Do Action classes change too? To convert our Hello World Action class 1) Update or remove imports. 2) Move input property ...
Do Action classes change too? To convert our Hello World Action class 1) Update or remove imports. 2) Move input property ...
Do Action classes change too? To convert our Hello World Action class 1) Update or remove imports. 2) Move input property ...
Do Action classes change too? To convert our Hello World Action class 1) Update or remove imports. 2) Move input property ...
Do Action classes change too? To convert our Hello World Action class 1) Update or remove imports. 2) Move input property ...
Do Action classes change too? To convert our Hello World Action class 1) Update or remove imports. 2) Move input property ...
Struts University Series
Do Action classes change too?Can combine Struts 1 **********Move ***** property to the ActionOr, use Plain Old Java ******...
Do Action classes change too? Can combine Struts 1 ActionForm Move ***** property to the Action Or, use Plain Old Java ***...
Do Action classes change too? Can combine Struts 1 ActionForm Move input property to the Action Or, use Plain Old Java ***...
Do Action classes change too? Can combine Struts 1 ActionForm Move input property to the Action Or, use Plain Old Java Obj...
Do Action classes change too? Can combine Struts 1 ActionForm Move input property to the Action Or, use Plain Old Java Obj...
Do Action classes change too? Can combine Struts 1 ActionForm, Move input property to the Action Or, use Plain Old Java Ob...
What about the tags?
<%@ taglib prefix="bean"    uri="http://struts.apache.org/tags-bean" %><html><head>    <title>Hello World!</title></head><...
<%@ taglib prefix="bean"    uri="http://struts.apache.org/tags-bean" %><html><head>    <title>Hello World!</title></head><...
Lets code it!
What about the tags?Replace the <%@ taglib @%> directiveChange <bean:write /> to <s:property />
What about the tags?Replace the <%@ taglib @%> directiveChange <bean:write /> to <s:property />
What about the tags?Replace the <%@ taglib @%> directiveChange <bean:write /> to <s:property />
What about the tags?New tags streamline page <bean:write> needs ActionForm name <s:property> finds property automatically
What about the tags?New tags streamline page <bean:write> needs ActionForm name <s:property> finds property automatically
What about the tags?New tags streamline page <bean:write> needs ActionForm name <s:property> finds property automatically
Struts University Series
What about the tags?Change <bean:write /> to <s:******** />New tags streamline page <bean:write> needs ActionForm name <...
What about the tags?Change <bean:write /> to <s:property />New tags streamline page <bean:write> needs ActionForm name <...
What about the tags?Change <bean:write /> to <s:property />New tags streamline page <bean:write> needs ActionForm name <...
What about the tags?Change <bean:write /> to <s:property />New tags streamline page <bean:write> needs ActionForm name <...
Can we still localize messages?  Struts 2 uses standard message bundle  Existing bundle set in struts.propertiesstruts.cus...
Can we still localize messages?  Struts 2 uses standard message bundle  Existing bundle set in struts.propertiesstruts.cus...
Can we still localize messages?  Struts 2 uses standard message bundle  Existing bundle set in struts.propertiesstruts.cus...
resources.propertiesmessage = Hello Worldresources_es.propertiesmessage = ¡Hola Mundo!
Can we still localize messages?Lookup message by key in ActionSet localized message to property
Can we still localize messages?Lookup message by key in ActionSet localized message to property
public class HelloAction extends Action {    public ActionForward execute(        ActionMapping mapping,        ActionForm...
public class Hello extends ActionSupport {    public String execute() throws Exception {-        setMessage(MESSAGE);+    ...
Can we still localize messages?Tags can output localized messages,based on a keyLets change page title to look up message
Can we still localize messages?Tags can output localized messages,based on a keyLets change page title to look up message
<%@ taglib prefix="bean"      uri="http://struts.apache.org/tags-bean" %>  <html><head>-     <title>Hello World!</title>+ ...
Lets code it!
Can we still localize messages?Lookup message by key in ActionSet localized message to propertyTags can output localized m...
Can we still localize messages?Lookup message by key in ActionSet localized message to propertyTags can output localized m...
Can we still localize messages?Lookup message by key in ActionSet localized message to propertyTags can output localized m...
Struts University Series
Can we still localize messages?(A)setMessage(getText(MESSAGE));(B)input.setMessage(  getResources(request).getMessage(MESS...
Can we still localize messages?(A)setMessage(getText(MESSAGE));(B)input.setMessage(  getResources(request).getMessage(MESS...
Can we still localize messages?struts.custom.i18n.********* = resources
Can we still localize messages?struts.custom.i18n.resources = resources
How do we change Locales?Locale is stored in users sessionStruts 1 requires a special Action
How do we change Locales?Locale is stored in users sessionStruts 1 requires a special Action
How do we change Locales?Locale is stored in users sessionStruts 1 requires a special Action
public final class LocaleAction extends Action {    private static final String LANGUAGE = "language";    private static f...
How do we change Locales?  Link to change Struts 1 locale      Calls Action to change Locale<li><html:link  action="/Loca...
How do we change Locales?  Link to change Struts 2 locale      No Action needed<li>  <s:url id="es" action="Hello">    <s...
Lets code it!
How do we change Locales?Pass "request_locale=es" as parameter1) "es" can be any standard locale code.2) Framework updates...
How do we change Locales?Pass "request_locale=es" as parameter1) "es" can be any standard locale code.2) Framework updates...
How do we change Locales?Pass "request_locale=es" as parameter1) "es" can be any standard locale code.2) Framework updates...
Struts University Series
How do we change Locales?(A) <li><html:link      action="/Locale?language=es">Español    </html:link></li>(B) <li><s:url i...
How do we change Locales?(A) <li><html:link      action="/Locale?language=es">Español    </html:link></li>(B) <li><s:url i...
Does Struts 2 use Commons Validator?Struts 2 uses XWork ValidatorSimilar but differentLets compare configurations
Does Struts 2 use Commons Validator?Struts 2 uses XWork ValidatorSimilar but differentLets compare configurations
Does Struts 2 use Commons Validator?Struts 2 uses XWork ValidatorSimilar but differentLets compare configurations
Does Struts 2 use Commons Validator?Struts 2 uses XWork ValidatorSimilar but differentLets compare configurations
<?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE form-validation PUBLIC  "-//Apache Software Foundation//DTD  Commons...
<?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE validators PUBLIC  "-//OpenSymphony Group//XWork Validator 1.0.2//EN...
Does Struts 2 use Commons Validator?Struts 1 We validate data on input Add input form to set message       Rather than ...
Does Struts 2 use Commons Validator?Struts 1 We validate data on input Add input form to set message       Rather than ...
Does Struts 2 use Commons Validator?Struts 1 We validate data on input Add input form to set message       Rather than ...
Does Struts 2 use Commons Validator?Struts 1 We validate data on input Add input form to set message       Rather than ...
<!-- ... -->   <action-mappings>       <action path="/HelloInput"               name="HelloForm"               forward="/H...
<html:errors/><html:form action="/Hello" focus="message"  onsubmit="return validateRegistrationForm(this);"><table>  <tr><...
Does Struts 2 use Commons Validator?Struts 2 Can reuse the same mapping Input represented by an alternate method Method...
Does Struts 2 use Commons Validator?Struts 2 Can reuse the same mapping Input represented by an alternate method Method...
Does Struts 2 use Commons Validator?Struts 2 Can reuse the same mapping Input represented by an alternate method Method...
Does Struts 2 use Commons Validator?Struts 2 Can reuse the same mapping Input represented by an alternate method Method...
<action name="Hello!*" method="{1}" class="actions.Hello">    <result>/Hello.jsp</result>    <result name="input">/Hello!i...
<action name="Hello!*" method="{1}" class="actions.Hello">    <result>/Hello.jsp</result>    <result name="input">/Hello!i...
Does Struts 2 use Commons Validator?Struts 1 has wildcards tooStill need to set validate=false on inputS2 input method ret...
Does Struts 2 use Commons Validator?Struts 1 has wildcards tooStill need to set validate=false on inputS2 input method ret...
Does Struts 2 use Commons Validator?Struts 1 has wildcards tooStill need to set validate=false on inputS2 input method ret...
Does Struts 2 use Commons Validator?Struts 1 has wildcards tooStill need to set validate=false on inputS2 input method ret...
Does Struts 2 use Commons Validator?Struts 1 has wildcards tooStill need to set validate=false on inputS2 input method ret...
Does Struts 2 use Commons Validator?Struts 1 has wildcards tooStill need to set validate=false on inputS2 input method ret...
resources.propertiesprompt = Enter Messagemessage = Hello World!# Struts 1errors.required={0} is required.# Struts 2requir...
Lets code it!
Does Struts 2 use Commons Validator?Struts 1: numeric parameter    errors.required= {0} is requiredStruts 2: expression l...
Does Struts 2 use Commons Validator?Struts 1: numeric parameter    errors.required= {0} is requiredStruts 2: expression l...
Struts University Series
Does Struts 2 use Commons Validator?Struts 2 uses X**** ValidatorS2 validation skipped on ***** method
Does Struts 2 use Commons Validator?Struts 2 uses XWork ValidatorS2 validation skipped on ***** method
Does Struts 2 use Commons Validator?Struts 2 uses XWork ValidatorS2 validation skipped on input method
Does Struts 2 use Commons Validator?Struts 2 uses XWork ValidatorS2 validation skipped on input method
Does Struts 2 use Commons Validator?(A) errors.required = {0} is required(B) requiredstring = ${getText(fieldName)}  is re...
Does Struts 2 use Commons Validator?(A) errors.required = {0} is required(B) requiredstring = ${getText(fieldName)}  is re...
Is that all there is?Cover the basics   mappings, Actions, tags, localization, and    validation.Converted Hello World to...
Is that all there is?Cover the basics   mappings, Actions, tags, localization, and    validation.Converted Hello World to...
Is that all there is?Cover the basics   mappings, Actions, tags, localization, and    validation.Converted Hello World to...
Is that all there is?          Struts 2 is a giant            leap forward, but,            for Struts 1            develo...
Struts University Series
Struts University Series
Struts University Series
Upcoming SlideShare
Loading in...5
×

Migrating to Struts2 of Struts1

3,656

Published on

1 Comment
1 Like
Statistics
Notes
No Downloads
Views
Total Views
3,656
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
166
Comments
1
Likes
1
Embeds 0
No embeds

No notes for slide

Migrating to Struts2 of Struts1

  1. 1. Migrating to Struts 2A tutorial for Struts 1 Developers Struts University Series
  2. 2. Migrating to Struts 2A tutorial for Struts 1 Developers Struts University Series
  3. 3. Ted? Whos Ted?Apache Software Foundation MemberApache Struts & Apache iBATIS PMCsJUnit in Action, Struts in Action, andProfessional JSP Site DesignConsult with teams throughout theUnited StatesStill working with the OK DEQ
  4. 4. Ted? Whos Ted?Apache Software Foundation MemberApache Struts & Apache iBATIS PMCsJUnit in Action, Struts in Action, andProfessional JSP Site DesignConsult with teams throughout theUnited StatesStill working with the OK DEQ
  5. 5. Ted? Whos Ted?Apache Software Foundation MemberApache Struts & Apache iBATIS PMCsJUnit in Action, Struts in Action, andProfessional JSP Site DesignConsult with teams throughout theUnited StatesStill working with the OK DEQ
  6. 6. Ted? Whos Ted?Apache Software Foundation MemberApache Struts & Apache iBATIS PMCsJUnit in Action, Struts in Action, andProfessional JSP Site DesignConsult with teams throughout theUnited StatesStill working with the OK DEQ
  7. 7. Ted? Whos Ted?Apache Software Foundation MemberApache Struts & Apache iBATIS PMCsJUnit in Action, Struts in Action, andProfessional JSP Site Design.Consult with teams throughout theUnited StatesStill working with the OK DEQ
  8. 8. Ted? Whos Ted?Apache Software Foundation MemberApache Struts & Apache iBATIS PMCsJUnit in Action, Struts in Action, andProfessional JSP Site Design.Consult with teams throughout theUnited StatesStill working with the OK DEQ
  9. 9. Migrating to Struts 2Help Struts 1 developers becomeknowledgeable Struts 2 developers asquickly as possibleMigrate Struts 1 application to Struts 2Intended for experienced Java webdevelopers
  10. 10. Migrating to Struts 2Help Struts 1 developers becomeknowledgeable Struts 2 developers asquickly as possibleMigrate Struts 1 application to Struts 2Intended for experienced Java webdevelopers
  11. 11. Migrating to Struts 2Help Struts 1 developers becomeknowledgeable Struts 2 developers asquickly as possibleMigrate Struts 1 application to Struts 2Intended for experienced Java webdevelopers
  12. 12. Migrating to Struts 2Help Struts 1 developers becomeknowledgeable Struts 2 developers asquickly as possibleMigrate Struts 1 application to Struts 2Intended for experienced Java webdevelopers
  13. 13. Baseline QuestionsWhat is Struts 2?How are Struts 1 and Struts alike?Whats changed in Struts 2?Is Struts 1 obsolete?Is it difficult to migrate?Why are "plain old Java objects" important?Where should a migration begin?
  14. 14. Baseline QuestionsWhat is Struts 2?How are Struts 1 and Struts alike?Whats changed in Struts 2?Is Struts 1 obsolete?Is it difficult to migrate?Why are "plain old Java objects" important?Where should a migration begin?
  15. 15. Baseline QuestionsWhat is Struts 2?How are Struts 1 and Struts alike?Whats changed in Struts 2?Is Struts 1 obsolete?Is it difficult to migrate?Why are "plain old Java objects" important?Where should a migration begin?
  16. 16. Baseline QuestionsWhat is Struts 2?How are Struts 1 and Struts alike?Whats changed in Struts 2?Is Struts 1 obsolete?Is it difficult to migrate?Why are "plain old Java objects" important?Where should a migration begin?
  17. 17. Baseline QuestionsWhat is Struts 2?How are Struts 1 and Struts alike?Whats changed in Struts 2?Is Struts 1 obsolete?Is it difficult to migrate?Why are "plain old Java objects" important?Where should a migration begin?
  18. 18. Baseline QuestionsWhat is Struts 2?How are Struts 1 and Struts alike?Whats changed in Struts 2?Is Struts 1 obsolete?Is it difficult to migrate?Why are "plain old Java objects" important?Where should a migration begin?
  19. 19. Baseline QuestionsWhat is Struts 2?How are Struts 1 and Struts alike?Whats changed in Struts 2?Is Struts 1 obsolete?Is it difficult to migrate?Why are "plain old Java objects" important?Where should a migration begin?
  20. 20. Baseline QuestionsWhat is Struts 2?How are Struts 1 and Struts alike?Whats changed in Struts 2?Is Struts 1 obsolete?Is it difficult to migrate?Why are "plain old Java objects" important?Where should a migration begin?
  21. 21. What is Struts 2?Free open-source framework Two major versionsStruts 1 Proven solution to common problemsStruts 2 Elegant solution to difficult problems
  22. 22. What is Struts 2?Free open-source framework Two major versionsStruts 1 Proven solution to common problemsStruts 2 Elegant solution to difficult problems
  23. 23. What is Struts 2?Free open-source framework Two major versionsStruts 1 Proven solution to common problemsStruts 2 Elegant solution to difficult problems
  24. 24. What is Struts 2?Free open-source framework Two major versionsStruts 1 Proven solution to common problemsStruts 2 Elegant solution to difficult problems
  25. 25. How are Struts 1 and Struts 2 alike?A "request" handler  maps Java classes to web application URIsA "response" handler  maps logical names to web resourcesA tag library  creates rich, form-based applications
  26. 26. How are Struts 1 and Struts 2 alike?A "request" handler  maps Java classes to web application URIsA "response" handler  maps logical names to web resourcesA tag library  creates rich, form-based applications
  27. 27. How are Struts 1 and Struts 2 alike?A "request" handler  maps Java classes to web application URIsA "response" handler  maps logical names to web resourcesA tag library  creates rich, form-based applications
  28. 28. How are Struts 1 and Struts 2 alike?A "request" handler  maps Java classes to web application URIsA "response" handler  maps logical names to web resourcesA tag library  creates rich, form-based applications
  29. 29. Whats changed in Struts 2?Smarter! Improved Design Intelligent Defaults Enhanced Results Enhanced Tags First-class AJAX support Stateful Checkboxes QuickStart
  30. 30. Whats changed in Struts 2?Smarter! Improved Design Intelligent Defaults Enhanced Results Enhanced Tags First-class AJAX support Stateful Checkboxes QuickStart
  31. 31. Whats changed in Struts 2?Smarter! Improved Design Intelligent Defaults Enhanced Results Enhanced Tags First-class AJAX support Stateful Checkboxes QuickStart
  32. 32. Whats changed in Struts 2?Smarter! Improved Design Intelligent Defaults Enhanced Results Enhanced Tags First-class AJAX support Stateful Checkboxes QuickStart
  33. 33. Whats changed in Struts 2?Smarter! Improved Design Intelligent Defaults Enhanced Results Enhanced Tags First-class AJAX support Stateful Checkboxes QuickStart
  34. 34. Whats changed in Struts 2?Smarter! Improved Design Intelligent Defaults Enhanced Results Enhanced Tags First-class AJAX support Stateful Checkboxes QuickStart
  35. 35. Whats changed in Struts 2?Smarter! Improved Design Intelligent Defaults Enhanced Results Enhanced Tags First-class AJAX support Stateful Checkboxes QuickStart
  36. 36. Whats changed in Struts 2?Smarter! Improved Design Intelligent Defaults Enhanced Results Enhanced Tags First-class AJAX support Stateful Checkboxes QuickStart
  37. 37. Whats changed in Struts 2?Smarter! Improved Design Intelligent Defaults Enhanced Results Enhanced Tags First-class AJAX support Stateful Checkboxes QuickStart
  38. 38. Whats Changed in Struts 2?Easier! Easy-to-test Actions Easy-to-customize controller Easy-to-tweak tags Easy cancel handling Easy Spring integration Easy plugins
  39. 39. Whats Changed in Struts 2?Easier! Easy-to-test Actions Easy-to-customize controller Easy-to-tweak tags Easy cancel handling Easy Spring integration Easy plugins
  40. 40. Whats Changed in Struts 2?Easier! Easy-to-test Actions Easy-to-customize controller Easy-to-tweak tags Easy cancel handling Easy Spring integration Easy plugins
  41. 41. Whats Changed in Struts 2?Easier! Easy-to-test Actions Easy-to-customize controller Easy-to-tweak tags Easy cancel handling Easy Spring integration Easy plugins
  42. 42. Whats Changed in Struts 2?Easier! Easy-to-test Actions Easy-to-customize controller Easy-to-tweak tags Easy cancel handling Easy Spring integration Easy plugins
  43. 43. Whats Changed in Struts 2?Easier! Easy-to-test Actions Easy-to-customize controller Easy-to-tweak tags Easy cancel handling Easy Spring integration Easy plugins
  44. 44. Whats Changed in Struts 2?Easier! Easy-to-test Actions Easy-to-customize controller Easy-to-tweak tags Easy cancel handling Easy Spring integration Easy plugins
  45. 45. Whats Changed in Struts 2POJO-ier! POJO forms POJO Actions
  46. 46. Whats Changed in Struts 2POJO-ier! POJO forms POJO Actions
  47. 47. Whats Changed in Struts 2POJO-ier! POJO forms POJO Actions
  48. 48. Is Struts 1 obsolete?Robust and vibrant communityThousands of applications in productionNew 1.3.5 releaseBut, is it time to try Struts 2?
  49. 49. Is Struts 1 obsolete?Robust and vibrant communityThousands of applications in productionNew 1.3.5 releaseBut, is it time to try Struts 2?
  50. 50. Is Struts 1 obsolete?Robust and vibrant communityThousands of applications in productionNew 1.3.5 releaseBut, is it time to try Struts 2?
  51. 51. Is Struts 1 obsolete?Robust and vibrant communityThousands of applications in productionNew 1.3.5 releaseBut, is it time to try Struts 2?
  52. 52. Is Struts 1 obsolete?Robust and vibrant communityThousands of applications in productionNew 1.3.5 releaseBut, is it time to try Struts 2?
  53. 53. Is it difficult to migrate?Not difficult but non-trivialMigrating Actions takes time and effortStable: may not be worth the effortGrowth: good investment
  54. 54. Is it difficult to migrate?Not difficult but non-trivialMigrating Actions takes time and effortStable: may not be worth the effortGrowth: good investment
  55. 55. Is it difficult to migrate?Not difficult but non-trivialMigrating Actions takes time and effortStable: may not be worth the effortGrowth: good investment
  56. 56. Is it difficult to migrate?Not difficult but non-trivialMigrating Actions takes time and effortStable: may not be worth the effortGrowth: good investment
  57. 57. Is it difficult to migrate?Not difficult but non-trivialMigrating Actions takes time and effortStable: may not be worth the effortGrowth: good investment
  58. 58. Is it difficult to migrate?Not difficult but non-trivialMigrating Actions takes time and effortStable: may not be worth the effortGrowth: good investmentStruts 2 is smarter, easier
  59. 59. Is it difficult to migrate?Not difficult but non-trivialMigrating Actions takes time and effortStable: may not be worth the effortGrowth: good investmentStruts 2 is smarter, easier, and POJO-ier
  60. 60. Why are POJOs important?No "extra" objects Instantiate Actions with new or Spring Simulate servlet state with HashMapRich input properties No ActionForms! Use Action or any other object Non-String properties are not a problem
  61. 61. Why are POJOs important?No "extra" objects Instantiate Actions with new or Spring Simulate servlet state with HashMapRich input properties No ActionForms! Use Action or any other object Non-String properties are not a problem
  62. 62. Why are POJOs important?No "extra" objects Instantiate Actions with new or Spring Simulate servlet state with HashMapRich input properties No ActionForms! Use Action or any other object Non-String properties are not a problem
  63. 63. Struts University Series
  64. 64. How are Struts 1 and Struts 2 alike?A "r******" handler  maps Java classes to web application URIsA "r*******" handler  maps logical names to web resourcesA *** library  creates rich, form-based applications
  65. 65. How are Struts 1 and Struts 2 alike?A "request" handler  maps Java classes to web application URIsA "r*******" handler  maps logical names to web resourcesA *** library  creates rich, form-based applications
  66. 66. How are Struts 1 and Struts 2 alike?A "request" handler  maps Java classes to web application URIsA "response" handler  maps logical names to web resourcesA *** library  creates rich, form-based applications
  67. 67. How are Struts 1 and Struts 2 alike?A "request" handler  maps Java classes to web application URIsA "response" handler  maps logical names to web resourcesA tag library  creates rich, form-based applications
  68. 68. How are Struts 1 and Struts 2 alike?A "request" handler  maps Java classes to web application URIsA "response" handler  maps logical names to web resourcesA tag library  creates rich, form-based applications
  69. 69. Where should a migration begin?Add Struts 2 JARsMigrate application page at a timeUse both versions at the same timeArchitectures can remain the sameRemove Struts 1 red tapeSwap in new tags
  70. 70. Where should a migration begin?Add Struts 2 JARsMigrate application page at a timeUse both versions at the same timeArchitectures can remain the sameRemove Struts 1 red tapeSwap in new tags
  71. 71. Where should a migration begin?Add Struts 2 JARsMigrate application page at a timeUse both versions at the same timeArchitectures can remain the sameRemove Struts 1 red tapeSwap in new tags
  72. 72. Where should a migration begin?Add Struts 2 JARsMigrate application page at a timeUse both versions at the same timeArchitectures can remain the sameRemove Struts 1 red tapeSwap in new tags
  73. 73. Where should a migration begin?Add Struts 2 JARsMigrate application page at a timeUse both versions at the same timeArchitectures can remain the sameRemove Struts 1 red tapeSwap in new tags
  74. 74. Where should a migration begin?Add Struts 2 JARsMigrate application page at a timeUse both versions at the same timeArchitectures can remain the sameRemove Struts 1 red tapeSwap in new tags
  75. 75. Where should a migration begin?Add Struts 2 JARsMigrate application page at a timeUse both versions at the same timeArchitectures can remain the sameRemove Struts 1 red tapeSwap in new tags
  76. 76. Where should a migration begin?Migrate "Hello World" applicationDisplays message in two languagesAdd input form for custom messageValidate data entry
  77. 77. Where should a migration begin?Migrate "Hello World" applicationDisplays message in two languagesAdd input form for custom messageValidate data entry
  78. 78. Where should a migration begin?Migrate "Hello World" applicationDisplays message in two languagesAdd input form for custom messageValidate data entry
  79. 79. Where should a migration begin?Migrate "Hello World" applicationDisplays message in two languagesAdd input form for custom messageValidate data entry
  80. 80. Where should a migration begin?Update web.xml to add ...1)The Struts 2 Filter2)A filter mapping3)The Spring Listener
  81. 81. Where should a migration begin?Update web.xml to add ...1)The Struts 2 Filter2)A filter mapping3)The Spring Listener
  82. 82. Where should a migration begin?Update web.xml to add ...1)The Struts 2 Filter2)A filter mapping3)The Spring Listener
  83. 83. Where should a migration begin?Update web.xml to add ...1)The Struts 2 Filter2)A filter mapping3)The Spring Listener
  84. 84. Where should a migration begin?Update web.xml to add ...1)The Struts 2 Filter2)A filter mapping3)The Spring Listener
  85. 85. <web-app> <!-- Struts 2 --> <filter> <filter-name>struts2</filter-name> <filter-class> org.apache.struts2.dispatcher.FilterDispatcher </filter-class> </filter> <filter-mapping><filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener>
  86. 86. <!-- Struts 1 --><servlet> <servlet-name>action</servlet-name> <servlet-class> org.apache.struts.action.ActionServlet </servlet-class> <init-param> <param-name>config</param-name> <param-value> /WEB-INF/classes/struts-config.xml </param-value> </init-param> <load-on-startup>2</load-on-startup></servlet><servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.do</url-pattern></servlet-mapping>
  87. 87. <!-- Either version --> <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list></web-app>
  88. 88. applicationContext.xml<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"><beans></beans>
  89. 89. Lets code it!
  90. 90. Where should a migration begin?Struts 1 actions handle *.doStruts 2 actions handle *.actionMigrate one to the other,until theres nothing left to "do"!
  91. 91. Where should a migration begin?Struts 1 actions handle *.doStruts 2 actions handle *.actionMigrate one to the other,until theres nothing left to "do"!
  92. 92. Where should a migration begin?Struts 1 actions handle *.doStruts 2 actions handle *.actionMigrate one to the other,until theres nothing left to "do"!
  93. 93. Where should a migration begin?Struts 1 actions handle *.doStruts 2 actions handle *.actionMigrate one to the other,until theres nothing left to "do"!
  94. 94. Struts University Series
  95. 95. Where should a migration begin?For dependency injection, by default,Struts 2 uses HiveMind Spring Castle Pico
  96. 96. Where should a migration begin?For dependency injection, by default,Struts 2 uses HiveMind Spring Castle Pico
  97. 97. Where should a migration begin?Update web.xml to add ... The Struts 2 ****** A filter ******* The ****** Listener
  98. 98. Where should a migration begin?Update web.xml to add ... The Struts 2 ****** A filter ******* The ****** Listener
  99. 99. Where should a migration begin?Update web.xml to add ... The Struts 2 Filter A filter ******* The ****** Listener
  100. 100. Where should a migration begin?Update web.xml to add ... The Struts 2 Filter A filter mapping The ****** Listener
  101. 101. Where should a migration begin?Update web.xml to add ... The Struts 2 Filter A filter mapping The Spring Listener
  102. 102. Where should a migration begin?Update web.xml to add ... The Struts 2 Filter A filter mapping The Spring Listener
  103. 103. Is the Struts 2 configuration file different? Struts 2 configuration file is streamlined Less to configure Element names are shorter Struts 1 is "struts-config.xml" Struts 2 is "struts.xml"
  104. 104. Is the Struts 2 configuration file different? Struts 2 configuration file is streamlined Less to configure Element names are shorter Struts 1 is "struts-config.xml" Struts 2 is "struts.xml"
  105. 105. Is the Struts 2 configuration file different? Struts 2 configuration file is streamlined Less to configure Element names are shorter Struts 1 is "struts-config.xml" Struts 2 is "struts.xml"
  106. 106. Is the Struts 2 configuration file different? Struts 2 configuration file is streamlined Less to configure Element names are shorter Struts 1 is "struts-config.xml" Struts 2 is "struts.xml"
  107. 107. Is the Struts 2 configuration file different? Struts 2 configuration file is streamlined Less to configure Element names are shorter Struts 1 is "struts-config.xml" Struts 2 is "struts.xml"
  108. 108. Is the Struts 2 configuration file different? Struts 2 configuration file is streamlined Less to configure Element names are shorter Struts 1 is "struts-config.xml" Struts 2 is "struts.xml"
  109. 109. <?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" "http://struts.apache.org/dtds/struts-config_1_3.dtd"><struts-config> <form-beans> <form-bean name="HelloForm" type="actions.HelloForm"> </form-bean> </form-beans> <action-mappings> <action path="/Hello" name="HelloForm" type="actions.HelloAction" validate="false"> <forward name="success" path="/HelloPage.jsp"/></action> </action-mappings> <message-resources parameter="resources"/></struts-config>
  110. 110. <?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"><struts> <include file="struts-default.xml"/> <package name="hello-default" extends="struts-default"> <action name="Hello" class="actions.Hello"> <result>/Hello.jsp</result> </action> </package></struts>
  111. 111. Lets code it!
  112. 112. To migrate configurationReplace the DTDChange <struts-config> to <struts>Add <include file="struts-default.xml"/>Remove the <form-beans> elementChange <action-mappings> to<package name="hello-default"extends="struts-default">Update each <action> element
  113. 113. To migrate configurationReplace the DTDChange <struts-config> to <struts>Add <include file="struts-default.xml"/>Remove the <form-beans> elementChange <action-mappings> to<package name="hello-default"extends="struts-default">Update each <action> element
  114. 114. To migrate configurationReplace the DTDChange <struts-config> to <struts>Add <include file="struts-default.xml"/>Remove the <form-beans> elementChange <action-mappings> to<package name="hello-default"extends="struts-default">Update each <action> element
  115. 115. To migrate configurationReplace the DTDChange <struts-config> to <struts>Add <include file="struts-default.xml"/>Remove the <form-beans> elementChange <action-mappings> to<package name="hello-default"extends="struts-default">Update each <action> element
  116. 116. To migrate configurationReplace the DTDChange <struts-config> to <struts>Add <include file="struts-default.xml"/>Remove the <form-beans> elementChange <action-mappings> to<package name="hello-default"extends="struts-default">Update each <action> element
  117. 117. To migrate configurationReplace the DTDChange <struts-config> to <struts>Add <include file="struts-default.xml"/>Remove the <form-beans> elementChange <action-mappings> to<package name="hello-default"extends="struts-default">Update each <action> element
  118. 118. To migrate configurationReplace the DTDChange <struts-config> to <struts>Add <include file="struts-default.xml"/>Remove the <form-beans> elementChange <action-mappings> to<package name="hello-default"extends="struts-default">Update each <action> element
  119. 119. To migrate configurationTo update each <action> element, we1)Remove from <action> the "name" attribute2)Change the <action> "path" attribute to "name", and "type" to "class"3)Change the <forward> element into a <result> element.
  120. 120. To migrate configurationTo update each <action> element, we1)Remove from <action> the "name" attribute2)Change the <action> "path" attribute to "name", and "type" to "class"3)Change the <forward> element into a <result> element.
  121. 121. To migrate configurationTo update each <action> element, we1)Remove from <action> the "name" attribute2)Change the <action> "path" attribute to "name", and "type" to "class"3)Change the <forward> element into a <result> element.
  122. 122. To migrate configurationTo update each <action> element, we1)Remove from <action> the "name" attribute2)Change the <action> "path" attribute to "name", and "type" to "class"3)Change the <forward> element into a <result> element.
  123. 123. Struts University Series
  124. 124. Is the Struts 2 configuration file different? Struts 2 configuration file is (less/more) to configure Struts 2 configuration file is named "******.xml" Most Struts 2 configurations include the “struts-*******.xml”
  125. 125. Is the Struts 2 configuration file different? Struts 2 configuration file is (less/more) to configure Struts 2 configuration file is named "******.xml" Most Struts 2 configurations include the “struts-*******.xml”
  126. 126. Is the Struts 2 configuration file different? Struts 2 configuration file is (less/more) to configure Struts 2 configuration file is named "struts.xml" Most Struts 2 configurations include the “struts-*******.xml”
  127. 127. Is the Struts 2 configuration file different? Struts 2 configuration file is (less/more) to configure Struts 2 configuration file is named "struts.xml" Most Struts 2 configurations include the “struts-default.xml”
  128. 128. Is the Struts 2 configuration file different? Struts 2 configuration file is (less/more) to configure Struts 2 configuration file is named "struts.xml" Most Struts 2 configurations include the “struts-default.xml”
  129. 129. To migrate configurationReplace the DTD****** <struts-config> to <struts>Add <include file="struts-default.xml"/>****** the <form-beans> elementChange <action-mappings> to<package name="hello-default"extends="struts-default">****** each <action> element
  130. 130. To migrate configurationReplace the DTDChange <struts-config> to <struts>Add <include file="struts-default.xml"/>****** the <form-beans> elementChange <action-mappings> to<package name="hello-default"extends="struts-default">****** each <action> element
  131. 131. To migrate configurationReplace the DTDChange <struts-config> to <struts>Add <include file="struts-default.xml"/>Remove the <form-beans> elementChange <action-mappings> to<package name="hello-default"extends="struts-default">****** each <action> element
  132. 132. To migrate configurationReplace the DTDChange <struts-config> to <struts>Add <include file="struts-default.xml"/>Remove the <form-beans> elementChange <action-mappings> to<package name="hello-default"extends="struts-default">Update each <action> element
  133. 133. To migrate configurationReplace the DTDChange <struts-config> to <struts>Add <include file="struts-default.xml"/>Remove the <form-beans> elementChange <action-mappings> to<package name="hello-default"extends="struts-default">Update each <action> element
  134. 134. Why so many changes?Obsolesce We just plain dont need them anymoreConsistency Attribute names are applied consistentlyComprehension Concise and easier to understand
  135. 135. Why so many changes?Obsolesce We just plain dont need them anymoreConsistency Attribute names are applied consistentlyComprehension Concise and easier to understand
  136. 136. Why so many changes?Obsolesce We just plain dont need them anymoreConsistency Attribute names are applied consistentlyComprehension Concise and easier to understand
  137. 137. Why so many changes?Obsolesce We just plain dont need them anymoreConsistency Attribute names are applied consistentlyComprehension Concise and easier to understand
  138. 138. Intelligent DefaultsWhen an essential value is omitted, the system automatically provides a predefined value, eliminating the need to explicitly qualify each and every aspect of a declaration. (Adapted from the CULE Knowledgebase)
  139. 139. Intelligent DefaultsWhen an essential value is omitted, the system automatically provides a predefined value, eliminating the need to explicitly qualify each and every aspect of a declaration. (Adapted from the CULE Knowledgebase)
  140. 140. Intelligent DefaultsWhen an essential value is omitted, the system automatically provides a predefined value, eliminating the need to explicitly qualify each and every aspect of a declaration. (Adapted from the CULE Knowledgebase)
  141. 141. Intelligent DefaultsWhen an essential value is omitted, the system automatically provides a predefined value, eliminating the need to explicitly qualify each and every aspect of a declaration. (Adapted from the CULE Knowledgebase)
  142. 142. Intelligent Defaults<forward name="success" path="/Hello.jsp"/><result>/Hello.jsp</result> The <result> name defaults to "success" The <result> content defaults to "location" (e.g. path) The <result> type defaults to "dispatch"
  143. 143. Intelligent Defaults<forward name="success" path="/Hello.jsp"/><result>/Hello.jsp</result> The <result> name defaults to "success" The <result> content defaults to "location" (e.g. path) The <result> type defaults to "dispatch"
  144. 144. Intelligent Defaults<forward name="success" path="/Hello.jsp"/><result>/Hello.jsp</result> The <result> name defaults to "success" The <result> content defaults to "location" (e.g. path) The <result> type defaults to "dispatch"
  145. 145. Intelligent Defaults<result name="cancel" type="redirect"> /Welcome.jsp</result> Changing the result name and type
  146. 146. Struts University Series
  147. 147. Why so many changes?O******** We just plain dont need them anymoreC********** Attribute names are uniformC************ Concise and easier to understand
  148. 148. Why so many changes?Obsolesce We just plain dont need them anymoreC********** Attribute names are uniformC************ Concise and easier to understand
  149. 149. Why so many changes?Obsolesce We just plain dont need them anymoreConsistency Attribute names are uniformC************ Concise and easier to understand
  150. 150. Why so many changes?Obsolesce We just plain dont need them anymoreConsistency Attribute names are uniformComprehension Concise and easier to understand
  151. 151. Why so many changes?Obsolesce We just plain dont need them anymoreConsistency Attribute names are uniformComprehension Concise and easier to understand
  152. 152. Intelligent DefaultsWhen an ********* value is omitted, the system automatically provides a ********** value, eliminating the need to explicitly qualify each and every aspect of a declaration. (Adapted from the CULE Knowledgebase)
  153. 153. Intelligent DefaultsWhen an essential value is omitted, the system automatically provides a ********** value, eliminating the need to explicitly qualify each and every aspect of a declaration. (Adapted from the CULE Knowledgebase)
  154. 154. Intelligent DefaultsWhen an essential value is omitted, the system automatically provides a predefined value, eliminating the need to explicitly qualify each and every aspect of a declaration. (Adapted from the CULE Knowledgebase)
  155. 155. Intelligent DefaultsWhen an essential value is omitted, the system automatically provides a predefined value, eliminating the need to explicitly qualify each and every aspect of a declaration. (Adapted from the CULE Knowledgebase)
  156. 156. Do Action classes change too? Mostly simpler Can combine Struts 1 ActionForm,  Add input properties directly to Action  Or, use POJO
  157. 157. Do Action classes change too? Mostly simpler Can combine Struts 1 ActionForm,  Add input properties directly to Action  Or, use POJO
  158. 158. Do Action classes change too? Mostly simpler Can combine Struts 1 ActionForm,  Add input properties directly to Action  Or, use POJO
  159. 159. package forms;import org.apache.struts.action.ActionForm;public class HelloForm extends ValidatorForm { private String message; public String getMessage() { return message; } public void setMessage(String message) { this.message = message; }}
  160. 160. package actions;import javax.servlet.http.*;import org.apache.struts.action.*;public class HelloAction extends Action { public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { HelloForm input = (HelloForm) form; input.setMessage(MESSAGE); return mapping.findForward(SUCCESS); } public static final String MESSAGE = "Hello World!"; public static final String SUCCESS = "success";}
  161. 161. package actions;import com.opensymphony.xwork2.ActionSupport;public class Hello extends ActionSupport { public String execute() throws Exception { setMessage(MESSAGE); return SUCCESS; } public static final String MESSAGE = "Hello World!"; private String message; public String getMessage() { return message; } public void setMessage(String message) { this.message = message; }}
  162. 162. Lets code it!
  163. 163. Do Action classes change too? To convert our Hello World Action class 1) Update or remove imports. 2) Move input property to the Action ● Remove obsolete ActionForm 3) Extend ActionSupport 4) Reference input property directly 5) Remove SUCCESS static
  164. 164. Do Action classes change too? To convert our Hello World Action class 1) Update or remove imports. 2) Move input property to the Action ● Remove obsolete ActionForm 3) Extend ActionSupport 4) Reference input property directly 5) Remove SUCCESS static
  165. 165. Do Action classes change too? To convert our Hello World Action class 1) Update or remove imports. 2) Move input property to the Action ● Remove obsolete ActionForm 3) Extend ActionSupport 4) Reference input property directly 5) Remove SUCCESS static
  166. 166. Do Action classes change too? To convert our Hello World Action class 1) Update or remove imports. 2) Move input property to the Action ● Remove obsolete ActionForm 3) Extend ActionSupport 4) Reference input property directly 5) Remove SUCCESS static
  167. 167. Do Action classes change too? To convert our Hello World Action class 1) Update or remove imports. 2) Move input property to the Action ● Remove obsolete ActionForm 3) Extend ActionSupport 4) Reference input property directly 5) Remove SUCCESS static
  168. 168. Do Action classes change too? To convert our Hello World Action class 1) Update or remove imports. 2) Move input property to the Action ● Remove obsolete ActionForm 3) Extend ActionSupport 4) Reference input property directly 5) Remove SUCCESS static
  169. 169. Struts University Series
  170. 170. Do Action classes change too?Can combine Struts 1 **********Move ***** property to the ActionOr, use Plain Old Java ******Extend ******Support
  171. 171. Do Action classes change too? Can combine Struts 1 ActionForm Move ***** property to the Action Or, use Plain Old Java ****** Extend ******Support
  172. 172. Do Action classes change too? Can combine Struts 1 ActionForm Move input property to the Action Or, use Plain Old Java ****** Extend ******Support
  173. 173. Do Action classes change too? Can combine Struts 1 ActionForm Move input property to the Action Or, use Plain Old Java Object Extend ******Support
  174. 174. Do Action classes change too? Can combine Struts 1 ActionForm Move input property to the Action Or, use Plain Old Java Object Extend ActionSupport
  175. 175. Do Action classes change too? Can combine Struts 1 ActionForm, Move input property to the Action Or, use Plain Old Java Object Extend ActionSupport
  176. 176. What about the tags?
  177. 177. <%@ taglib prefix="bean" uri="http://struts.apache.org/tags-bean" %><html><head> <title>Hello World!</title></head><body> <h2><bean:write name="HelloForm" property="message"/></h2></body></html><%@ taglib prefix="s" uri="/struts-tags" %><html><head> <title>Hello World!</title></head><body> <h2><s:property value="message"/></h2></body></html>
  178. 178. <%@ taglib prefix="bean" uri="http://struts.apache.org/tags-bean" %><html><head> <title>Hello World!</title></head><body> <h2><bean:write name="HelloForm" property="message"/></h2></body></html><%@ taglib prefix="s" uri="/struts-tags" %><html><head> <title>Hello World!</title></head><body> <h2><s:property value="message"/></h2></body></html>
  179. 179. Lets code it!
  180. 180. What about the tags?Replace the <%@ taglib @%> directiveChange <bean:write /> to <s:property />
  181. 181. What about the tags?Replace the <%@ taglib @%> directiveChange <bean:write /> to <s:property />
  182. 182. What about the tags?Replace the <%@ taglib @%> directiveChange <bean:write /> to <s:property />
  183. 183. What about the tags?New tags streamline page <bean:write> needs ActionForm name <s:property> finds property automatically
  184. 184. What about the tags?New tags streamline page <bean:write> needs ActionForm name <s:property> finds property automatically
  185. 185. What about the tags?New tags streamline page <bean:write> needs ActionForm name <s:property> finds property automatically
  186. 186. Struts University Series
  187. 187. What about the tags?Change <bean:write /> to <s:******** />New tags streamline page <bean:write> needs ActionForm name <s:********> finds ******** automatically
  188. 188. What about the tags?Change <bean:write /> to <s:property />New tags streamline page <bean:write> needs ActionForm name <s:********> finds ******** automatically
  189. 189. What about the tags?Change <bean:write /> to <s:property />New tags streamline page <bean:write> needs ActionForm name <s:property> finds property automatically
  190. 190. What about the tags?Change <bean:write /> to <s:property />New tags streamline page <bean:write> needs ActionForm name <s:property> finds property automatically
  191. 191. Can we still localize messages? Struts 2 uses standard message bundle Existing bundle set in struts.propertiesstruts.custom.i18n.resources = resources resources.properties resources_es.properties resources_fr_CA.properties
  192. 192. Can we still localize messages? Struts 2 uses standard message bundle Existing bundle set in struts.propertiesstruts.custom.i18n.resources = resources resources.properties resources_es.properties resources_fr_CA.properties
  193. 193. Can we still localize messages? Struts 2 uses standard message bundle Existing bundle set in struts.propertiesstruts.custom.i18n.resources = resources resources.properties resources_es.properties resources_fr_CA.properties
  194. 194. resources.propertiesmessage = Hello Worldresources_es.propertiesmessage = ¡Hola Mundo!
  195. 195. Can we still localize messages?Lookup message by key in ActionSet localized message to property
  196. 196. Can we still localize messages?Lookup message by key in ActionSet localized message to property
  197. 197. public class HelloAction extends Action { public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { HelloForm input = (HelloForm) form;- input.setMessage(MESSAGE);+ input.setMessage(getResources(+ request).getMessage(MESSAGE)); return mapping.findForward(SUCCESS); }- public static final String MESSAGE = "Hello World!";+ public static final String MESSAGE = "message"; public static final String SUCCESS = "success";}
  198. 198. public class Hello extends ActionSupport { public String execute() throws Exception {- setMessage(MESSAGE);+ setMessage(getText(MESSAGE)); return SUCCESS; }- public static final String MESSAGE = "Hello World!";+ public static final String MESSAGE = "message";}
  199. 199. Can we still localize messages?Tags can output localized messages,based on a keyLets change page title to look up message
  200. 200. Can we still localize messages?Tags can output localized messages,based on a keyLets change page title to look up message
  201. 201. <%@ taglib prefix="bean" uri="http://struts.apache.org/tags-bean" %> <html><head>- <title>Hello World!</title>+ <title><bean:message key="message"/></title> </head> <body> <h2><bean:write name="HelloForm" property="message"/></h2> </body></html> <%@ taglib prefix="s" uri="/struts-tags" %> <html><head>- <title>Hello World!</title>+ <title><s:text name="message"/></title> </head> <body> <h2><s:property value="message"/></h2> </body></html>
  202. 202. Lets code it!
  203. 203. Can we still localize messages?Lookup message by key in ActionSet localized message to propertyTags can output localized messages,based on a key
  204. 204. Can we still localize messages?Lookup message by key in ActionSet localized message to propertyTags can output localized messages,based on a key
  205. 205. Can we still localize messages?Lookup message by key in ActionSet localized message to propertyTags can output localized messages,based on a key
  206. 206. Struts University Series
  207. 207. Can we still localize messages?(A)setMessage(getText(MESSAGE));(B)input.setMessage( getResources(request).getMessage(MESSAGE));The Struts 1 statement is shown as (A) / (B).The Struts 2 statement is shown as (A) / (B).
  208. 208. Can we still localize messages?(A)setMessage(getText(MESSAGE));(B)input.setMessage( getResources(request).getMessage(MESSAGE));The Struts 1 statement is shown as (A) / (B).The Struts 2 statement is shown as (A) / (B).
  209. 209. Can we still localize messages?struts.custom.i18n.********* = resources
  210. 210. Can we still localize messages?struts.custom.i18n.resources = resources
  211. 211. How do we change Locales?Locale is stored in users sessionStruts 1 requires a special Action
  212. 212. How do we change Locales?Locale is stored in users sessionStruts 1 requires a special Action
  213. 213. How do we change Locales?Locale is stored in users sessionStruts 1 requires a special Action
  214. 214. public final class LocaleAction extends Action { private static final String LANGUAGE = "language"; private static final String COUNTRY = "country"; private static final String SUCCESS = "success"; public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String language = request.getParameter(LANGUAGE); String country = request.getParameter(COUNTRY); Locale locale = getLocale(request); if ((language != null && language.length() > 0) && (country != null && country.length() > 0)) { locale = new java.util.Locale(language, country); } else if (language != null && language.length() > 0) { locale = new java.util.Locale(language, ""); } setLocale(request, locale); return mapping.findForward(SUCCESS); }}
  215. 215. How do we change Locales? Link to change Struts 1 locale  Calls Action to change Locale<li><html:link action="/Locale?language=es">Español</html:link></li>
  216. 216. How do we change Locales? Link to change Struts 2 locale  No Action needed<li> <s:url id="es" action="Hello"> <s:param name="request_locale">es</s:param> </s:url> <s:a href="%{es}">Español</s:a></li>
  217. 217. Lets code it!
  218. 218. How do we change Locales?Pass "request_locale=es" as parameter1) "es" can be any standard locale code.2) Framework updates locale for session.
  219. 219. How do we change Locales?Pass "request_locale=es" as parameter1) "es" can be any standard locale code.2) Framework updates locale for session.
  220. 220. How do we change Locales?Pass "request_locale=es" as parameter1) "es" can be any standard locale code.2) Framework updates locale for session.
  221. 221. Struts University Series
  222. 222. How do we change Locales?(A) <li><html:link action="/Locale?language=es">Español </html:link></li>(B) <li><s:url id="es" action="Hello"> <s:param name="request_locale">es</s:param> </s:url><s:a href="%{es}">Español</s:a> </li>The Struts 1 statement is shown as (A) / (B).The Struts 2 statement is shown as (A) / (B).
  223. 223. How do we change Locales?(A) <li><html:link action="/Locale?language=es">Español </html:link></li>(B) <li><s:url id="es" action="Hello"> <s:param name="request_locale">es</s:param> </s:url><s:a href="%{es}">Español</s:a> </li>The Struts 1 statement is shown as (A) / (B).The Struts 2 statement is shown as (A) / (B).
  224. 224. Does Struts 2 use Commons Validator?Struts 2 uses XWork ValidatorSimilar but differentLets compare configurations
  225. 225. Does Struts 2 use Commons Validator?Struts 2 uses XWork ValidatorSimilar but differentLets compare configurations
  226. 226. Does Struts 2 use Commons Validator?Struts 2 uses XWork ValidatorSimilar but differentLets compare configurations
  227. 227. Does Struts 2 use Commons Validator?Struts 2 uses XWork ValidatorSimilar but differentLets compare configurations
  228. 228. <?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE form-validation PUBLIC "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.3.0//EN""http://jakarta.apache.org/commons/dtds/validator_1_3_0.dtd"><form-validation> <formset> <form name="HelloForm"> <field property="message" depends="required"> <arg key="message"/> </field> </form> </formset></form-validation>
  229. 229. <?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"><validators> <field name="message"> <field-validator type="requiredstring"> <message key="requiredstring"/> </field-validator> </field></validators>
  230. 230. Does Struts 2 use Commons Validator?Struts 1 We validate data on input Add input form to set message  Rather than Action
  231. 231. Does Struts 2 use Commons Validator?Struts 1 We validate data on input Add input form to set message  Rather than Action
  232. 232. Does Struts 2 use Commons Validator?Struts 1 We validate data on input Add input form to set message  Rather than Action
  233. 233. Does Struts 2 use Commons Validator?Struts 1 We validate data on input Add input form to set message  Rather than Action
  234. 234. <!-- ... --> <action-mappings> <action path="/HelloInput" name="HelloForm" forward="/HelloInput.jsp" validate="false" /> <action path="/Hello" name="HelloForm" forward="/HelloPage.jsp" validate="true" input="/HelloInput.do" /> </action-mappings></struts-config>
  235. 235. <html:errors/><html:form action="/Hello" focus="message" onsubmit="return validateRegistrationForm(this);"><table> <tr><td> Message: </td><td> <html:text property="message" /> </td></tr></table></html:form>
  236. 236. Does Struts 2 use Commons Validator?Struts 2 Can reuse the same mapping Input represented by an alternate method Methods can be called via wildcards
  237. 237. Does Struts 2 use Commons Validator?Struts 2 Can reuse the same mapping Input represented by an alternate method Methods can be called via wildcards
  238. 238. Does Struts 2 use Commons Validator?Struts 2 Can reuse the same mapping Input represented by an alternate method Methods can be called via wildcards
  239. 239. Does Struts 2 use Commons Validator?Struts 2 Can reuse the same mapping Input represented by an alternate method Methods can be called via wildcards
  240. 240. <action name="Hello!*" method="{1}" class="actions.Hello"> <result>/Hello.jsp</result> <result name="input">/Hello!input.jsp</result></action><s:actionerrors/><s:form action="Hello"> <s:textfield label="Message" name="message"/></s:form>
  241. 241. <action name="Hello!*" method="{1}" class="actions.Hello"> <result>/Hello.jsp</result> <result name="input">/Hello!input.jsp</result></action><s:actionerrors/><s:form action="Hello"> <s:textfield label="Message" name="message"/></s:form>
  242. 242. Does Struts 2 use Commons Validator?Struts 1 has wildcards tooStill need to set validate=false on inputS2 input method returns “input” symbolS2 validation skipped on input methodInput form posts back to execute (or save, or store, or submit)
  243. 243. Does Struts 2 use Commons Validator?Struts 1 has wildcards tooStill need to set validate=false on inputS2 input method returns “input” symbolS2 validation skipped on input methodInput form posts back to execute (or save, or store, or submit)
  244. 244. Does Struts 2 use Commons Validator?Struts 1 has wildcards tooStill need to set validate=false on inputS2 input method returns “input” symbolS2 validation skipped on input methodInput form posts back to execute (or save, or store, or submit)
  245. 245. Does Struts 2 use Commons Validator?Struts 1 has wildcards tooStill need to set validate=false on inputS2 input method returns “input” symbolS2 validation skipped on input methodInput form posts back to execute (or save, or store, or submit)
  246. 246. Does Struts 2 use Commons Validator?Struts 1 has wildcards tooStill need to set validate=false on inputS2 input method returns “input” symbolS2 validation skipped on input methodInput form posts back to execute (or save, or store, or submit)
  247. 247. Does Struts 2 use Commons Validator?Struts 1 has wildcards tooStill need to set validate=false on inputS2 input method returns “input” symbolS2 validation skipped on input methodInput form posts back to execute (or save, or store, or submit)
  248. 248. resources.propertiesprompt = Enter Messagemessage = Hello World!# Struts 1errors.required={0} is required.# Struts 2requiredstring = ${getText(fieldName)} is required.resources_es.propertiesprompt = Entre el mensajemessage = ¡Hola Mundo!# Struts 1errors.required={0} se requiere.# Struts 2requiredstring = ${getText(fieldName)} se requiere.
  249. 249. Lets code it!
  250. 250. Does Struts 2 use Commons Validator?Struts 1: numeric parameter errors.required= {0} is requiredStruts 2: expression language requiredstring= ${getText(fieldName)} is required.
  251. 251. Does Struts 2 use Commons Validator?Struts 1: numeric parameter errors.required= {0} is requiredStruts 2: expression language requiredstring= ${getText(fieldName)} is required.
  252. 252. Struts University Series
  253. 253. Does Struts 2 use Commons Validator?Struts 2 uses X**** ValidatorS2 validation skipped on ***** method
  254. 254. Does Struts 2 use Commons Validator?Struts 2 uses XWork ValidatorS2 validation skipped on ***** method
  255. 255. Does Struts 2 use Commons Validator?Struts 2 uses XWork ValidatorS2 validation skipped on input method
  256. 256. Does Struts 2 use Commons Validator?Struts 2 uses XWork ValidatorS2 validation skipped on input method
  257. 257. Does Struts 2 use Commons Validator?(A) errors.required = {0} is required(B) requiredstring = ${getText(fieldName)} is required.The Struts 1 statement is shown as (A) / (B).The Struts 2 statement is shown as (A) / (B).
  258. 258. Does Struts 2 use Commons Validator?(A) errors.required = {0} is required(B) requiredstring = ${getText(fieldName)} is required.The Struts 1 statement is shown as (A) / (B).The Struts 2 statement is shown as (A) / (B).
  259. 259. Is that all there is?Cover the basics mappings, Actions, tags, localization, and validation.Converted Hello World to Struts 2 Moved one at a time Actions, pages, and configuration elements Shared essential resources, like message bundles, between the versions.
  260. 260. Is that all there is?Cover the basics mappings, Actions, tags, localization, and validation.Converted Hello World to Struts 2 Moved one at a time Actions, pages, and configuration elements Shared essential resources, like message bundles, between the versions.
  261. 261. Is that all there is?Cover the basics mappings, Actions, tags, localization, and validation.Converted Hello World to Struts 2 Moved one at a time Actions, pages, and configuration elements Shared essential resources, like message bundles, between the versions.
  262. 262. Is that all there is? Struts 2 is a giant leap forward, but, for Struts 1 developers, its a learning curve we can walk, one step at a time.
  263. 263. Struts University Series
  264. 264. Struts University Series
  265. 265. Struts University Series
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×