SlideShare una empresa de Scribd logo
1 de 70
Descargar para leer sin conexión
Introduction to Struts
Andrew J. Dick
Red Hook Group
andrew@redhookgroup.com
Colorado Software Summit
What Is Struts?
?Framework for writing applications using
 MVC architecture
  ?Open source
    • Part of Apache’s Jakarta Project
    • Current production version 1.0.2
  ?Model 2 architecture implementation
?Provides standard framework infrastructure
  ?Makes no presumptions about business and
   application objects it deals with
    • Could be EJBs, CORBA, directly from database, XML
      tree
What Is MVC?
?Stands for Model-View-Controller
  ?Design paradigm
    • Originated in the Smalltalk community
?Decouples data access code, business logic
 code and presentation code
  ?Often ripple effects occur when changes are
   required in applications without this separation
What Is MVC?
?MVC Components
  ?Model
     • Application data
  ?View
     • Translates Model into
       readable form
  ?Controller
     • Processes user input
     • Initiates change in state
       of Model
     • In web design also
       responsible for flow
       control
Struts & MVC
?MVC implementation
  ?Model – Business Services, Transfer Objects
    • Business Services populate and return Transfer
      Objects
  ?View – JSPs, ActionForms
    • JSP queries ActionForm for form data
  ?Controller – ActionServlet, Actions
    • ActionServlet delegates control to Action class
      instances
Struts Components
?ActionServlet    ?ActionForms
?Actions          ?Resource Management
?ActionMappings   ?Tag Libraries
?ActionForwards   ?Configuration
?ActionErrors     ?Logging
What Is the ActionServlet
?Manages application flow of control
  ?Primary controller for Struts framework
?Performs initialization for application such as
  ?Parses Struts configuration file
     • Loads application message resources
     • Initializes:
        ?Action mapping cache
        ?Application defined data sources
        ?Servlet mapping information
What Does the ActionServlet
    Do?
?For each user request
  ?Identifies action to invoke from URI
  ?Instantiates ActionForm bean if required by
   mapping configuration
    • Initialized with submitted form’s field values
  ?Calls the Action’s perform method
    • May have to load and instantiate Action first
?HTTP GET and POST treated identically
ActionServlet Processing
?Segment of Struts ActionServlet request
 processing
   ? * Copyright (c) 1999-2001 The Apache Software Foundation. All rights
     reserved

protected void process(HttpServletRequest request,
                       HttpServletResponse response)

  …
   // Acquire the Action instance to process this request
   Action actionInstance = processActionCreate(mapping, request);
  …
   ActionForward forward
         = processActionPerform(actionInstance, mapping,
                                formInstance, request, response);
   …
   processActionForward(forward, mapping, formInstance,
                        request, response);
Struts 1.1 ActionServlet
?Introduction of Request Processor
  ?Handles much of the functionality of the
   ActionServlet in Struts 1.0
  ?Allows developers to more easily customize the
   request handling behavior
What Is an Action?
?Bridge between HTTP request and business
 services
?Typically performs single task or business
 operation
?Alternatively can group cohesive actions
 together within an Action class
  ?Reduces number of required Action classes
How Is an Action Used?
?Implements perform() method
?Executed by ActionServlet according to
 defined ActionMappings
?Single instance per Action class type
  ?Therefore must be threadsafe
What Does an Action Do?
?Processes request parameters
?Invokes appropriate business service
?Prepares business service results
?Determines path to follow
  ?Uses ActionMapping to determine where to
   dispatch the user based on
    • Request parameters
    • Business service results
Action Relationships

ActionForm   uses          Action         queries   ActionMapping




                                invokes



                    Business Service
Action Interactions
ActionServlet                Action       ActionForm   Business Service   ActionMapping


          1: perform
                                  2: getInput




                                  3: saveInput




                                  4: findForward




         5: return forward
Example Action
public ActionForward perform(ActionMapping mapping,
                              ActionForm form,
                              HttpServletRequest req,
                              HttpServletResponse resp)
          throws IOException, ServletException {
   …
   final EditPersonForm editPersonForm = (EditPersonForm) form;
   final String action = editPersonForm.getSelected();
   if (WebConstants.SAVE.equals(action)) {
      savePerson(editPersonForm.getModifiedPerson());
      return mapping.findForward(quot;savequot;);
   }
   else {
      // Initial pass - forward to the view
      return mapping.findForward(quot;viewquot;);
   }
How Is an Action Configured?
<action-mappings>
   <action path=quot;/person/editPersonquot;
           type=quot;com.redhook.examples.genealogy.web.EditPersonActionquot;
           scope=quot;requestquot;
           name=quot;edit.person.formquot;
           input=quot;/person/editPerson.jspquot;
           validate=quot;truequot;>
      <forward name=quot;savequot;
               path=quot;/common/welcome.doquot;
               redirect=quot;truequot;/>
      <forward name=“viewquot;
               path=quot;/common/editPerson.jspquot;/>
   </action>
</action-mappings>
Struts 1.1 Actions
?Method perform() replaced by
 execute()
  ?Backwards compatible
  ?Change necessary to support declarative
   exception handling
?Addition of DispatchAction class
  ?Supports multiple business methods instead of a
   single execute() method
    • Allows easy grouping of related business methods
What Is an ActionMapping?
?Encapsulates mapping information
  ?Used to hold information that the ActionServlet
   knows about a mapping
?Allows meta information to be passed to
 Action object
  ?e.g. Configuration mappings for an Action
How Is an ActionMapping
    Used?
?Passed to Action class when perform()
 invoked
  ?Can be queried by Action class for information
  ?Used to determine where user should be
   forwarded or redirected
ActionMapping Interactions
ActionServlet         Action          ActionMapping   Business Service   ActionForward   JSP


       1: perform

                          2: Invoke


                          3: findForward



         4: return


         5: get URI




         6: forward
Example ActionMapping -
      Usage
?Used to look up ActionForwards with a
 lookup name
try {
   delegate.createPerson(personInfo);
   return mapping.findForward(“save”);
}

?Can also be used to retrieve input source
catch (final DuplicatePersonException duplicatePersonException) {
   ActionErrors errors = new ActionErrors();
   ActionError error = new ActionError(“error.duplicate.name”);
   errors.add(“name”, error);
   saveErrors(request, errors);
   return mapping.findForward(mapping.getInput());
}
How Is an ActionMapping
      Configured?
?Parent element of Action in the application
 configuration
<action-mappings>
   <action path=“/editPerson”>
      …
      <forward name=“save” path=“/person/viewPersonProfile.do”
               redirect=“true”/>
   </action>
   <action path=“/findPerson”>
      …
      <forward name=“view” path=“/person/displayList.jsp”/>
   </action>
      …
</action-mappings>
What Is an ActionForward?
?Logical abstraction of a web resource
  ?Minimizes coupling of an application to physical
   resources
?Encapsulates URI that ActionServlet can
 redirect control to
  ?Three properties
    • Name – lookup key
    • Path – URI
    • Redirect – whether to redirect or forward
How Is an ActionForward
    Used?
?Defined as local to an action or global to the
 application
?Look up via ActionMapping class
  ?findForward
?Can also be dynamically created by
 specifying URI
ActionForward Interactions
ActionServlet         Action           ActionMapping   Business Service   ActionForward   JSP


        1: perform

                           2: Invoke


                          3: findForward



         4: return


         5: get URI




         6: forward
Example ActionForward
public ActionForward perform(…) throws IOException,
   ServletException {
   …
   String action = form.getSelected();
   ActionForward forward;
   if (action.equals(“login”)) {
      forward = mapping.findForward(“login”);
   }
   else {
      forward = new ActionForward(
         “http://authserver:7001/authcontrol”, true);
   }

    return forward;
}
How Is an ActionForward
      Configured?
? Can be configured globally
<global-forwards>
   <forward name=quot;welcomequot;
            path=quot;/common/welcome.doquot;
            redirect=quot;truequot;/>
</global-forwards>


? Or relative to an action
<action>
   …
   <forward name=quot;viewquot; path=quot;/common/welcome.jspquot;/>
</action>
What Is an ActionError?
?Represents an error condition detected
 during application workflow
?Passed through the system in a container
 object
  ?ActionErrors
How Is an ActionError Used?
?Created in ActionForm validate() or
 Action perform() method
?Created with error message key and
 parameters
?Added to error container with key
  ?Represents form field causing the error
?ActionErrors is a request scope object
  ?Only exists until the input JSP is redisplayed with
   the error messages
What Does an ActionError Do?
?Used to transport error messages to the user
?Supports internationalization of error
 messages
?Allows user to be notified of multiple error
 conditions
  ?Prevents a cycle of submit, display error,
   resubmit, display next error…
ActionError Relationships
     Action                    ActionForm




    Creates                       Creates


                ActionError                        JSP

                                        Displays




                        0..*

              ActionErrors
ActionError Interactions
Client               ActionServlet                      ActionForm               JSP

         1: Submit

                                     2: Validate

                                                                                              3: new ()
                                                                                                                       ActionErrors


                                                                              4: new ()
                                                                                                         ActionError


                                                                     5: Add


                                     6: return




                                     7: Forward

                                                                                          8: Get error



                                                                                          9: Get message



                                           10:     Display message
How Is an ActionError
    Configured?
?Error messages defined in resource bundle
  ?ApplicationResources.properties by default
  ?Can be parameterized with up to five parameters
    • e.g. error.invalid.date=Date {0} is not valid
?Error header and footer defined
  ?errors.header and errors.footer
  ?If present, added before and after error
   messages
Example ActionError - Creation
?Created in ActionForm validate method
public ActionErrors validate(ActionMapping mapping,
                             HttpServletRequest request) {
   ActionErrors errors = new ActionErrors();
   try {
      DateFormat.parse(getBirthDate());
   }
   catch (final ParseException parseException) {
      ActionError error = new ActionError(“error.invalid.date”),
                                          getBirthDate());
      errors.add(“birthDate”, error);
   }

    return errors;
}
Example ActionError - Creation
?Can also be created in Action perform
 method
  ?Generally if business validation is necessary
     • e.g. Uniqueness of input
 …
 try {
    personDelegate.createPerson(personInfo);
 }
 catch (final DuplicatePersonException duplicatePersonException) {
    ActionErrors errors = new ActionErrors();
    ActionError error = new ActionError(“error.duplicate.name”);
    errors.add(“name”, error);
    saveErrors(request, errors);
    return mapping.findForward(mapping.getInput());
 }
Example ActionError - Display
<form method=“post” action=“createPerson”>
<table>
   …
   <tr>
      <td>Birthdate</td>
        <td><input type=“text” name=“birthDate”/></td>
   </tr>
   <tr>
      <td><html:errors/></td>
   </tr>
   <tr>
      <td><input type=“submit” name=“Submit” value=“Create”></td>
   </tr>
</table>
</form>
Struts 1.1 ActionErrors
?New ActionMessage super class introduced
  ?Used for more general purpose messages
     • Action ‘Error’ implies improper to use for informational
       or warning messages
?Introduction of declarative exception
 handling
  ?Allows definition of exception handling policy
   externally
What Is an ActionForm?
?Defines an abstract class for managing forms
  ?Standard callback for form validation
  ?Standard callback for resetting a form
?Supports form management by
  ?Capturing input data
  ?Validation of form data
  ?Returning error message on validation failure
  ?Transferring data to Action class
  ?Determining which action was submitted
    • If multiple submits in the form
How Is an ActionForm Used?
?Defines accessors and mutators for form
 being maintained
?Implements validate and reset methods
  ?Validate performs validation of data
    • Only called if form configured for validation
  ?Reset allows recycling of forms
?Two levels of scope – session (default) and
 request
  ?Session used to support multi-page wizards
?Form passed into Action class when invoked
What Does an ActionForm Do?
?When a form is submitted, the ActionServlet
 will:
  ?Detect which ActionForm subclass is associated
   with the mapping (if any)
  ?Find an existing instance or instantiate one
  ?Populate it with form data from the request
  ?Invoke the ActionForm’s validate method
  ?Pass the ActionForm instance to the Action
   instance
    • If validation successful
ActionForm Relationships

                                    ActionForm       invokes     ActionServlet
       populated from




                                   creates



JSP                     displays       ActionError             ActionErrors
ActionForm Interactions
Client           ActionServlet               ActionForm                                              JSP


     1: submit

                             2: validate
                                                      3: new ()
                                                                                ActionErrors

                                                      4: new ()
                                                                  ActionError


                                                      5: add
                                 6: return




                             7: forward




                                                                                 8: display errors
Example ActionForm
public ActionErrors validate(ActionMapping mapping,
                              HttpServletRequest request) {
   ActionErrors errors = new ActionErrors();
   try {
      DateFormat.parse(getBirthDate());
   } catch (final ParseException parseException) {
      errors.add(“birthDate”,
                 new ActionError(“error.invalid.date”),
                                  getBirthDate());
   }
   if ((getName() == null) || (getName().equals(“”))) {
      errors.add(“name”, new ActionError(“error.name.required”));
   }

    return errors;
}
How Is an ActionForm
      Configured?
<form-beans>
   <form-bean name=“edit.person.formquot;
      type=quot;com.redhook.examples.genealogy.web.EditPersonFormquot;/>
</form-beans>
…
<action path=quot;/person/editPersonquot;
        type=quot;com.redhook.examples.genealogy.web.EditPersonActionquot;
        name=“edit.person.formquot;
        scope=quot;requestquot;
        input=quot;/person/editPerson.jspquot;
        validate=quot;truequot;>
   <forward name=“savequot; path=quot;/common/welcome.doquot; redirect=quot;truequot;/>
</action>
Struts 1.1 ActionForms
?Dynamic Forms introduced
  ?Configured in configuration file rather than
   coding
  ?Version exists that works with validator package
   to provide automatic validation
Struts 1.1 Validation
?Validator framework from Jakarta
  ?Part of Commons sub-project
?Struts 1.1 includes this by default
  ?Allows declarative validation for many fields
     • e.g. Formats
        ?Dates, Numbers, Email, Credit Card, Postal Codes
     • Lengths
        ?Minimum, maximum
     • Ranges
  ?Can also be configured for Struts 1.0
Struts Resource Management
?Centralizes resource administration for
  ?Internationalization
  ?Error treatment
  ?Standard labeling
?By default ApplicationResources.properties
  ?Can be changed in web.xml configuration
  ?Must be located on class path
     • Typically in WEB-INF/classes
ResourceManagement –
    ApplicationResources.properties
# Titles
title.welcome=Genealogy Tree

# Labels
label.first.name=First Name:

# Links
link.add.person=Add a new person

# Resources
resource.image.save=/images/save.gif

# Errors
error.invalid.date=Date {0} is not valid.
Struts Resource Management
?Can be accessed from JSP through tag
 libraries
  <bean:message key=“label.first.name”/>
  <html:img pageKey=“resource.image.save”/>
?Can also be accessed in Action objects
 through MessageResources
  MessageResources messages = getResources();
  Locale locale = getLocale(request);
  messages.getMessage(“label.namequot;, locale);
Struts & TagLibs
?Struts supports four tag libraries
  ?Not mandatory
     • Renders cleaner pages
     • Not limited to these four
  ?Provides flexible way to
     • Access application and framework objects under
       different scopes
     • Render objects to output stream, handle validation
       and processing errors
     • Support internationalization capabilities
     • Create page templates that support reusable design
Struts & TagLibs
?What is required to use them?
   ?web.xml tag library declaration for each library
<taglib>
   <taglib-uri>/WEB-INF/tlds/struts-bean.tld</taglib-uri>
   <taglib-location>
      /WEB-INF/tlds/struts-bean.tld
   </taglib-location>
</taglib>

   ?Taglib directive on each target page
<%@ taglib uri='/WEB-INF/tlds/struts-bean.tld'
           prefix='bean' %>
Bean Tag Library
?Provides ways to access and expose beans
 and properties in the application
?Provides internationalization functionality
  ?Includes parametric replacement
?Bean references can be created
?String constants can be defined
HTML Tag Library
?Provides support for rendering html controls
  ?Input controls, images, forms, etc.
?Includes support for:
  ?JavaScript event handling
  ?Cascading Style Sheets
  ?Navigation attributes
?Supports display of errors found during form
 validation
Logic Tag Library
?Conditional generation of content
  ?Supports comparison properties equality to a
   constant
  ?Conditional on presence (or lack) of variables or
   properties
    • Includes cookies, roles, etc.
?Navigational forwarding or redirection
?Iteration of collection elements
Template Tag Library
?Allows atomic views to be created
  ?i.e. Section, Header, Footer, Content
?Views can then be added to a defined layout
Struts & TagLibs
?Can also use other tag libraries
  ?Jakarta TagLibs
  ?JSTL
  ?Custom Tags
?Struts 1.1
  ?Tile TagLib supercedes Template TagLib
     • Provides more extensive layout support
  ?Nested TagLib
     • Extends base Struts Taglibs to support relation to
       each other in a nested manner
Configuration
?Two aspects to Struts configuration
  ?web.xml
  ?struts-config.xml
Configuration – Web.xml
<web-app>
   <servlet>
      <servlet-name>action</servlet-name>
      <servlet-class>org.apache.struts.action.ActionServlet</servlet-
   class>
      <init-param>
          <param-name>application</param-name>
          <param-value>ApplicationResources</param-value>
      </init-param>
      <init-param>
          <param-name>config</param-name>
          <param-value>/WEB-INF/struts-config.xml</param-value>
      </init-param>
      <load-on-startup>1</load-on-startup>
   </servlet>
   …
Configuration – Web.xml
<web-app>
   …
   <servlet-mapping>
      <servlet-name>action</servlet-name>
      <url-pattern>*.do</url-pattern>
   </servlet-mapping>

  <welcome-file-list>
     <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
Configuration – Web.xml
<web-app>
   …

   <taglib>
      <taglib-uri>/WEB-INF/tlds/struts-bean.tld</taglib-uri>
      <taglib-location>
         /WEB-INF/tlds/struts-bean.tld
      </taglib-location>
   </taglib>
</web-app>
Configuration –
        Struts-config.xml
<struts-config>
   <form-beans>
      <form-bean name=quot;edit.person.formquot;
                  type=quot;com.redhook.examples.genealogy.web.EditPersonFormquot;/>
   </form-beans>
   <global-forwards>
      <forward name=quot;welcomequot; path=quot;/common/welcome.doquot; redirect=quot;truequot;/>
   </global-forwards>
   <action-mappings>
      <action path=quot;/person/editPersonquot;
                type=quot;com.redhook.examples.genealogy.web.EditPersonActionquot;
                name=quot;edit.person.formquot;
                scope=quot;requestquot;
                input=quot;/person/editPerson.jspquot;
                validate=quot;truequot;>
         <forward name=quot;savequot; path=quot;/common/welcome.doquot; redirect=quot;truequot;/>
      </action>
   </action-mappings>
</struts-config>
Configuration –
        Struts-config.xml
<struts-config>
   <form-beans>
      <form-bean name=“edit.person.formquot;
                  type=quot;com.redhook.examples.genealogy.web.EditPersonFormquot;/>
   </form-beans>
   <global-forwards>
      <forward name=quot;welcomequot; path=quot;/common/welcome.doquot; redirect=quot;truequot;/>
   </global-forwards>
   <action-mappings>
      <action path=quot;/person/editPersonquot;
                type=quot;com.redhook.examples.genealogy.web.EditPersonActionquot;
                scope=quot;requestquot;
                name=“edit.person.formquot;
                input=quot;/person/editPerson.jspquot;
                validate=quot;truequot;>
         <forward name=quot;savequot; path=quot;/common/welcome.doquot; redirect=quot;truequot;/>
      </action>
   </action-mappings>
</struts-config>
Configuration –
        Struts-config.xml
<struts-config>
   <form-beans>
      <form-bean name=quot;edit.person.formquot;
                  type=quot;com.redhook.examples.genealogy.web.EditPersonFormquot;/>
   </form-beans>
   <global-forwards>
      <forward name=quot;welcomequot; path=quot;/common/welcome.doquot; redirect=quot;truequot;/>
   </global-forwards>
   <action-mappings>
      <action path=quot;/person/editPersonquot;
                type=quot;com.redhook.examples.genealogy.web.EditPersonActionquot;
                scope=quot;requestquot;
                name=quot;edit.person.formquot;
                input=quot;/person/editPerson.jspquot;
                validate=quot;truequot;>
         <forward name=quot;savequot; path=quot;/common/welcome.doquot; redirect=quot;truequot;/>
      </action>
   </action-mappings>
</struts-config>
Struts 1.1 Configuration
?Adds support for
  ?Multiple application modules
  ?Declarative exceptions
  ?Plug in elements
  ?Multiple message resource elements
?Visual configuration tools can also be found
  ?Both commercial and open-source
     • http://jakarta.apache.org/struts/resources/guis.html
Logging
?Important aspect of applications
  ?3rd party logging frameworks used pre JDK 1.4
    • i.e. log4j
  ?Logging API introduced with JDK 1.4
    • Similar to log4j
       ?Hierarchical categories
       ?Logging levels
Logging
?What does Struts provide?
  ?Nothing
?Jakarta project provides thin logging
 wrapper
  ?Part of Commons subproject
  ?Provides wrappers for standard logging
   frameworks
     • JDK 1.4, log4j, etc.
  ?Can also develop wrapper for custom logging
   API
Logging
?Why use Jakarta Common Logging?
  ?Can declaratively switch logging frameworks
  ?Implementation wrapper class declared in a
   properties file
?Must still configure logging framework in
 typical way
  ?i.e. log4j.properties
?Jakarta also provides logging tag library
  ?Useful for debugging
     • Allows dump of scope attributes
Resources
?JSP and Tag Libraries for Web Development
  by Wellington L.S. da Silva, New Riders Publishing
  ISBN: 0-73571-095-3
?Programming Jakarta Struts
  By Chuck Cavaness, O’Reilly & Associates (October 2002)
  ISBN: 0-59600-328-5
?Struts in Action: A Practical Guide to the Leading
 Java Web Framework
  by Ted Husted et al., Manning Publications Company
  ISBN: 1930110502
Websites
? http://jakarta.apache.org/struts/index.html
? http://www.husted.com/struts

? Sample app can be found at:
   ? http://www.redhookgroup.com/downloads/css/genealogy.zip


?Thank you.

?Any questions
   ?andrew@redhookgroup.com

Más contenido relacionado

La actualidad más candente

Introduction to Spring MVC
Introduction to Spring MVCIntroduction to Spring MVC
Introduction to Spring MVCRichard Paul
 
Spring 3.x - Spring MVC
Spring 3.x - Spring MVCSpring 3.x - Spring MVC
Spring 3.x - Spring MVCGuy Nir
 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Tuna Tore
 
"Inside The AngularJS Directive Compiler" by Tero Parviainen
"Inside The AngularJS Directive Compiler" by Tero Parviainen"Inside The AngularJS Directive Compiler" by Tero Parviainen
"Inside The AngularJS Directive Compiler" by Tero ParviainenFwdays
 
Uma introdução ao framework Spring
Uma introdução ao framework SpringUma introdução ao framework Spring
Uma introdução ao framework Springelliando dias
 
springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892Tuna Tore
 
Architecting Single Activity Applications (With or Without Fragments)
Architecting Single Activity Applications (With or Without Fragments)Architecting Single Activity Applications (With or Without Fragments)
Architecting Single Activity Applications (With or Without Fragments)Gabor Varadi
 
GraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learnedGraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learnedMarcinStachniuk
 
Java Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAXJava Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAXIMC Institute
 
Struts tutorial
Struts tutorialStruts tutorial
Struts tutorialOPENLANE
 

La actualidad más candente (17)

Spring MVC
Spring MVCSpring MVC
Spring MVC
 
Introduction to Spring MVC
Introduction to Spring MVCIntroduction to Spring MVC
Introduction to Spring MVC
 
Spring 3.x - Spring MVC
Spring 3.x - Spring MVCSpring 3.x - Spring MVC
Spring 3.x - Spring MVC
 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5
 
Thinking Beyond ORM in JPA
Thinking Beyond ORM in JPAThinking Beyond ORM in JPA
Thinking Beyond ORM in JPA
 
JavaFX Pitfalls
JavaFX PitfallsJavaFX Pitfalls
JavaFX Pitfalls
 
Second Level Cache in JPA Explained
Second Level Cache in JPA ExplainedSecond Level Cache in JPA Explained
Second Level Cache in JPA Explained
 
"Inside The AngularJS Directive Compiler" by Tero Parviainen
"Inside The AngularJS Directive Compiler" by Tero Parviainen"Inside The AngularJS Directive Compiler" by Tero Parviainen
"Inside The AngularJS Directive Compiler" by Tero Parviainen
 
Angular js
Angular jsAngular js
Angular js
 
Uma introdução ao framework Spring
Uma introdução ao framework SpringUma introdução ao framework Spring
Uma introdução ao framework Spring
 
Thinking Beyond ORM in JPA
Thinking Beyond ORM in JPAThinking Beyond ORM in JPA
Thinking Beyond ORM in JPA
 
springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892
 
Architecting Single Activity Applications (With or Without Fragments)
Architecting Single Activity Applications (With or Without Fragments)Architecting Single Activity Applications (With or Without Fragments)
Architecting Single Activity Applications (With or Without Fragments)
 
GraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learnedGraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learned
 
Java Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAXJava Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAX
 
Struts tutorial
Struts tutorialStruts tutorial
Struts tutorial
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
 

Destacado

Struts Introduction Course
Struts Introduction CourseStruts Introduction Course
Struts Introduction Courseguest764934
 
The impact of innovation on travel and tourism industries (World Travel Marke...
The impact of innovation on travel and tourism industries (World Travel Marke...The impact of innovation on travel and tourism industries (World Travel Marke...
The impact of innovation on travel and tourism industries (World Travel Marke...Brian Solis
 
Open Source Creativity
Open Source CreativityOpen Source Creativity
Open Source CreativitySara Cannon
 
Reuters: Pictures of the Year 2016 (Part 2)
Reuters: Pictures of the Year 2016 (Part 2)Reuters: Pictures of the Year 2016 (Part 2)
Reuters: Pictures of the Year 2016 (Part 2)maditabalnco
 
The Six Highest Performing B2B Blog Post Formats
The Six Highest Performing B2B Blog Post FormatsThe Six Highest Performing B2B Blog Post Formats
The Six Highest Performing B2B Blog Post FormatsBarry Feldman
 
The Outcome Economy
The Outcome EconomyThe Outcome Economy
The Outcome EconomyHelge Tennø
 

Destacado (8)

Struts Introduction Course
Struts Introduction CourseStruts Introduction Course
Struts Introduction Course
 
Introduction to struts
Introduction to strutsIntroduction to struts
Introduction to struts
 
Struts 1
Struts 1Struts 1
Struts 1
 
The impact of innovation on travel and tourism industries (World Travel Marke...
The impact of innovation on travel and tourism industries (World Travel Marke...The impact of innovation on travel and tourism industries (World Travel Marke...
The impact of innovation on travel and tourism industries (World Travel Marke...
 
Open Source Creativity
Open Source CreativityOpen Source Creativity
Open Source Creativity
 
Reuters: Pictures of the Year 2016 (Part 2)
Reuters: Pictures of the Year 2016 (Part 2)Reuters: Pictures of the Year 2016 (Part 2)
Reuters: Pictures of the Year 2016 (Part 2)
 
The Six Highest Performing B2B Blog Post Formats
The Six Highest Performing B2B Blog Post FormatsThe Six Highest Performing B2B Blog Post Formats
The Six Highest Performing B2B Blog Post Formats
 
The Outcome Economy
The Outcome EconomyThe Outcome Economy
The Outcome Economy
 

Similar a Introduction to Struts

Strutsjspservlet
Strutsjspservlet Strutsjspservlet
Strutsjspservlet Sagar Nakul
 
Strutsjspservlet
Strutsjspservlet Strutsjspservlet
Strutsjspservlet Sagar Nakul
 
Project Description Of Incident Management System Developed by PRS (CRIS) , N...
Project Description Of Incident Management System Developed by PRS (CRIS) , N...Project Description Of Incident Management System Developed by PRS (CRIS) , N...
Project Description Of Incident Management System Developed by PRS (CRIS) , N...varunsunny21
 
Struts Java I I Lecture 8
Struts  Java  I I  Lecture 8Struts  Java  I I  Lecture 8
Struts Java I I Lecture 8patinijava
 
[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é
 
Migrating from Struts 1 to Struts 2
Migrating from Struts 1 to Struts 2Migrating from Struts 1 to Struts 2
Migrating from Struts 1 to Struts 2Matt Raible
 
Training: Day Four - Struts, Tiles, Renders and Faces
Training: Day Four - Struts, Tiles, Renders and FacesTraining: Day Four - Struts, Tiles, Renders and Faces
Training: Day Four - Struts, Tiles, Renders and FacesArtur Ventura
 
Stepbystepguideforbuidlingsimplestrutsapp 090702025438-phpapp02
Stepbystepguideforbuidlingsimplestrutsapp 090702025438-phpapp02Stepbystepguideforbuidlingsimplestrutsapp 090702025438-phpapp02
Stepbystepguideforbuidlingsimplestrutsapp 090702025438-phpapp02Rati Manandhar
 
Building Web Apps with Express
Building Web Apps with ExpressBuilding Web Apps with Express
Building Web Apps with ExpressAaron Stannard
 
Asynchronous Interfaces
Asynchronous InterfacesAsynchronous Interfaces
Asynchronous Interfacesmaccman
 
Struts An Open-source Architecture for Web Applications
Struts An Open-source Architecture for Web ApplicationsStruts An Open-source Architecture for Web Applications
Struts An Open-source Architecture for Web Applicationselliando dias
 
Asp.Net Mvc
Asp.Net MvcAsp.Net Mvc
Asp.Net Mvcmicham
 
Step By Step Guide For Buidling Simple Struts App
Step By Step Guide For Buidling Simple Struts AppStep By Step Guide For Buidling Simple Struts App
Step By Step Guide For Buidling Simple Struts AppSyed Shahul
 
Introducing Struts 2
Introducing Struts 2Introducing Struts 2
Introducing Struts 2wiradikusuma
 
A portlet-API based approach for application integration
A portlet-API based approach for application integrationA portlet-API based approach for application integration
A portlet-API based approach for application integrationwhabicht
 

Similar a Introduction to Struts (20)

Struts Intro
Struts IntroStruts Intro
Struts Intro
 
Struts,Jsp,Servlet
Struts,Jsp,ServletStruts,Jsp,Servlet
Struts,Jsp,Servlet
 
Strutsjspservlet
Strutsjspservlet Strutsjspservlet
Strutsjspservlet
 
Strutsjspservlet
Strutsjspservlet Strutsjspservlet
Strutsjspservlet
 
Project Description Of Incident Management System Developed by PRS (CRIS) , N...
Project Description Of Incident Management System Developed by PRS (CRIS) , N...Project Description Of Incident Management System Developed by PRS (CRIS) , N...
Project Description Of Incident Management System Developed by PRS (CRIS) , N...
 
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)
 
Struts Java I I Lecture 8
Struts  Java  I I  Lecture 8Struts  Java  I I  Lecture 8
Struts Java I I Lecture 8
 
[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)
 
Migrating from Struts 1 to Struts 2
Migrating from Struts 1 to Struts 2Migrating from Struts 1 to Struts 2
Migrating from Struts 1 to Struts 2
 
Struts Overview
Struts OverviewStruts Overview
Struts Overview
 
Training: Day Four - Struts, Tiles, Renders and Faces
Training: Day Four - Struts, Tiles, Renders and FacesTraining: Day Four - Struts, Tiles, Renders and Faces
Training: Day Four - Struts, Tiles, Renders and Faces
 
Stepbystepguideforbuidlingsimplestrutsapp 090702025438-phpapp02
Stepbystepguideforbuidlingsimplestrutsapp 090702025438-phpapp02Stepbystepguideforbuidlingsimplestrutsapp 090702025438-phpapp02
Stepbystepguideforbuidlingsimplestrutsapp 090702025438-phpapp02
 
Building Web Apps with Express
Building Web Apps with ExpressBuilding Web Apps with Express
Building Web Apps with Express
 
Asynchronous Interfaces
Asynchronous InterfacesAsynchronous Interfaces
Asynchronous Interfaces
 
Os Haase
Os HaaseOs Haase
Os Haase
 
Struts An Open-source Architecture for Web Applications
Struts An Open-source Architecture for Web ApplicationsStruts An Open-source Architecture for Web Applications
Struts An Open-source Architecture for Web Applications
 
Asp.Net Mvc
Asp.Net MvcAsp.Net Mvc
Asp.Net Mvc
 
Step By Step Guide For Buidling Simple Struts App
Step By Step Guide For Buidling Simple Struts AppStep By Step Guide For Buidling Simple Struts App
Step By Step Guide For Buidling Simple Struts App
 
Introducing Struts 2
Introducing Struts 2Introducing Struts 2
Introducing Struts 2
 
A portlet-API based approach for application integration
A portlet-API based approach for application integrationA portlet-API based approach for application integration
A portlet-API based approach for application integration
 

Más de elliando dias

Clojurescript slides
Clojurescript slidesClojurescript slides
Clojurescript slideselliando dias
 
Why you should be excited about ClojureScript
Why you should be excited about ClojureScriptWhy you should be excited about ClojureScript
Why you should be excited about ClojureScriptelliando dias
 
Functional Programming with Immutable Data Structures
Functional Programming with Immutable Data StructuresFunctional Programming with Immutable Data Structures
Functional Programming with Immutable Data Structureselliando dias
 
Nomenclatura e peças de container
Nomenclatura  e peças de containerNomenclatura  e peças de container
Nomenclatura e peças de containerelliando dias
 
Polyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better AgilityPolyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better Agilityelliando dias
 
Javascript Libraries
Javascript LibrariesJavascript Libraries
Javascript Librarieselliando dias
 
How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!elliando dias
 
A Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the WebA Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the Webelliando dias
 
Introdução ao Arduino
Introdução ao ArduinoIntrodução ao Arduino
Introdução ao Arduinoelliando dias
 
Incanter Data Sorcery
Incanter Data SorceryIncanter Data Sorcery
Incanter Data Sorceryelliando dias
 
Fab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine DesignFab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine Designelliando dias
 
The Digital Revolution: Machines that makes
The Digital Revolution: Machines that makesThe Digital Revolution: Machines that makes
The Digital Revolution: Machines that makeselliando dias
 
Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.elliando dias
 
Hadoop and Hive Development at Facebook
Hadoop and Hive Development at FacebookHadoop and Hive Development at Facebook
Hadoop and Hive Development at Facebookelliando dias
 
Multi-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case StudyMulti-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case Studyelliando dias
 

Más de elliando dias (20)

Clojurescript slides
Clojurescript slidesClojurescript slides
Clojurescript slides
 
Why you should be excited about ClojureScript
Why you should be excited about ClojureScriptWhy you should be excited about ClojureScript
Why you should be excited about ClojureScript
 
Functional Programming with Immutable Data Structures
Functional Programming with Immutable Data StructuresFunctional Programming with Immutable Data Structures
Functional Programming with Immutable Data Structures
 
Nomenclatura e peças de container
Nomenclatura  e peças de containerNomenclatura  e peças de container
Nomenclatura e peças de container
 
Geometria Projetiva
Geometria ProjetivaGeometria Projetiva
Geometria Projetiva
 
Polyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better AgilityPolyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better Agility
 
Javascript Libraries
Javascript LibrariesJavascript Libraries
Javascript Libraries
 
How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!
 
Ragel talk
Ragel talkRagel talk
Ragel talk
 
A Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the WebA Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the Web
 
Introdução ao Arduino
Introdução ao ArduinoIntrodução ao Arduino
Introdução ao Arduino
 
Minicurso arduino
Minicurso arduinoMinicurso arduino
Minicurso arduino
 
Incanter Data Sorcery
Incanter Data SorceryIncanter Data Sorcery
Incanter Data Sorcery
 
Rango
RangoRango
Rango
 
Fab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine DesignFab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine Design
 
The Digital Revolution: Machines that makes
The Digital Revolution: Machines that makesThe Digital Revolution: Machines that makes
The Digital Revolution: Machines that makes
 
Hadoop + Clojure
Hadoop + ClojureHadoop + Clojure
Hadoop + Clojure
 
Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.
 
Hadoop and Hive Development at Facebook
Hadoop and Hive Development at FacebookHadoop and Hive Development at Facebook
Hadoop and Hive Development at Facebook
 
Multi-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case StudyMulti-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case Study
 

Último

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
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
 
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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
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
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
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
 
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
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
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
 
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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 

Último (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
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
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
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
 
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
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
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
 
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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

Introduction to Struts

  • 1. Introduction to Struts Andrew J. Dick Red Hook Group andrew@redhookgroup.com Colorado Software Summit
  • 2. What Is Struts? ?Framework for writing applications using MVC architecture ?Open source • Part of Apache’s Jakarta Project • Current production version 1.0.2 ?Model 2 architecture implementation ?Provides standard framework infrastructure ?Makes no presumptions about business and application objects it deals with • Could be EJBs, CORBA, directly from database, XML tree
  • 3. What Is MVC? ?Stands for Model-View-Controller ?Design paradigm • Originated in the Smalltalk community ?Decouples data access code, business logic code and presentation code ?Often ripple effects occur when changes are required in applications without this separation
  • 4. What Is MVC? ?MVC Components ?Model • Application data ?View • Translates Model into readable form ?Controller • Processes user input • Initiates change in state of Model • In web design also responsible for flow control
  • 5. Struts & MVC ?MVC implementation ?Model – Business Services, Transfer Objects • Business Services populate and return Transfer Objects ?View – JSPs, ActionForms • JSP queries ActionForm for form data ?Controller – ActionServlet, Actions • ActionServlet delegates control to Action class instances
  • 6. Struts Components ?ActionServlet ?ActionForms ?Actions ?Resource Management ?ActionMappings ?Tag Libraries ?ActionForwards ?Configuration ?ActionErrors ?Logging
  • 7. What Is the ActionServlet ?Manages application flow of control ?Primary controller for Struts framework ?Performs initialization for application such as ?Parses Struts configuration file • Loads application message resources • Initializes: ?Action mapping cache ?Application defined data sources ?Servlet mapping information
  • 8. What Does the ActionServlet Do? ?For each user request ?Identifies action to invoke from URI ?Instantiates ActionForm bean if required by mapping configuration • Initialized with submitted form’s field values ?Calls the Action’s perform method • May have to load and instantiate Action first ?HTTP GET and POST treated identically
  • 9. ActionServlet Processing ?Segment of Struts ActionServlet request processing ? * Copyright (c) 1999-2001 The Apache Software Foundation. All rights reserved protected void process(HttpServletRequest request, HttpServletResponse response) … // Acquire the Action instance to process this request Action actionInstance = processActionCreate(mapping, request); … ActionForward forward = processActionPerform(actionInstance, mapping, formInstance, request, response); … processActionForward(forward, mapping, formInstance, request, response);
  • 10. Struts 1.1 ActionServlet ?Introduction of Request Processor ?Handles much of the functionality of the ActionServlet in Struts 1.0 ?Allows developers to more easily customize the request handling behavior
  • 11. What Is an Action? ?Bridge between HTTP request and business services ?Typically performs single task or business operation ?Alternatively can group cohesive actions together within an Action class ?Reduces number of required Action classes
  • 12. How Is an Action Used? ?Implements perform() method ?Executed by ActionServlet according to defined ActionMappings ?Single instance per Action class type ?Therefore must be threadsafe
  • 13. What Does an Action Do? ?Processes request parameters ?Invokes appropriate business service ?Prepares business service results ?Determines path to follow ?Uses ActionMapping to determine where to dispatch the user based on • Request parameters • Business service results
  • 14. Action Relationships ActionForm uses Action queries ActionMapping invokes Business Service
  • 15. Action Interactions ActionServlet Action ActionForm Business Service ActionMapping 1: perform 2: getInput 3: saveInput 4: findForward 5: return forward
  • 16. Example Action public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { … final EditPersonForm editPersonForm = (EditPersonForm) form; final String action = editPersonForm.getSelected(); if (WebConstants.SAVE.equals(action)) { savePerson(editPersonForm.getModifiedPerson()); return mapping.findForward(quot;savequot;); } else { // Initial pass - forward to the view return mapping.findForward(quot;viewquot;); }
  • 17. How Is an Action Configured? <action-mappings> <action path=quot;/person/editPersonquot; type=quot;com.redhook.examples.genealogy.web.EditPersonActionquot; scope=quot;requestquot; name=quot;edit.person.formquot; input=quot;/person/editPerson.jspquot; validate=quot;truequot;> <forward name=quot;savequot; path=quot;/common/welcome.doquot; redirect=quot;truequot;/> <forward name=“viewquot; path=quot;/common/editPerson.jspquot;/> </action> </action-mappings>
  • 18. Struts 1.1 Actions ?Method perform() replaced by execute() ?Backwards compatible ?Change necessary to support declarative exception handling ?Addition of DispatchAction class ?Supports multiple business methods instead of a single execute() method • Allows easy grouping of related business methods
  • 19. What Is an ActionMapping? ?Encapsulates mapping information ?Used to hold information that the ActionServlet knows about a mapping ?Allows meta information to be passed to Action object ?e.g. Configuration mappings for an Action
  • 20. How Is an ActionMapping Used? ?Passed to Action class when perform() invoked ?Can be queried by Action class for information ?Used to determine where user should be forwarded or redirected
  • 21. ActionMapping Interactions ActionServlet Action ActionMapping Business Service ActionForward JSP 1: perform 2: Invoke 3: findForward 4: return 5: get URI 6: forward
  • 22. Example ActionMapping - Usage ?Used to look up ActionForwards with a lookup name try { delegate.createPerson(personInfo); return mapping.findForward(“save”); } ?Can also be used to retrieve input source catch (final DuplicatePersonException duplicatePersonException) { ActionErrors errors = new ActionErrors(); ActionError error = new ActionError(“error.duplicate.name”); errors.add(“name”, error); saveErrors(request, errors); return mapping.findForward(mapping.getInput()); }
  • 23. How Is an ActionMapping Configured? ?Parent element of Action in the application configuration <action-mappings> <action path=“/editPerson”> … <forward name=“save” path=“/person/viewPersonProfile.do” redirect=“true”/> </action> <action path=“/findPerson”> … <forward name=“view” path=“/person/displayList.jsp”/> </action> … </action-mappings>
  • 24. What Is an ActionForward? ?Logical abstraction of a web resource ?Minimizes coupling of an application to physical resources ?Encapsulates URI that ActionServlet can redirect control to ?Three properties • Name – lookup key • Path – URI • Redirect – whether to redirect or forward
  • 25. How Is an ActionForward Used? ?Defined as local to an action or global to the application ?Look up via ActionMapping class ?findForward ?Can also be dynamically created by specifying URI
  • 26. ActionForward Interactions ActionServlet Action ActionMapping Business Service ActionForward JSP 1: perform 2: Invoke 3: findForward 4: return 5: get URI 6: forward
  • 27. Example ActionForward public ActionForward perform(…) throws IOException, ServletException { … String action = form.getSelected(); ActionForward forward; if (action.equals(“login”)) { forward = mapping.findForward(“login”); } else { forward = new ActionForward( “http://authserver:7001/authcontrol”, true); } return forward; }
  • 28. How Is an ActionForward Configured? ? Can be configured globally <global-forwards> <forward name=quot;welcomequot; path=quot;/common/welcome.doquot; redirect=quot;truequot;/> </global-forwards> ? Or relative to an action <action> … <forward name=quot;viewquot; path=quot;/common/welcome.jspquot;/> </action>
  • 29. What Is an ActionError? ?Represents an error condition detected during application workflow ?Passed through the system in a container object ?ActionErrors
  • 30. How Is an ActionError Used? ?Created in ActionForm validate() or Action perform() method ?Created with error message key and parameters ?Added to error container with key ?Represents form field causing the error ?ActionErrors is a request scope object ?Only exists until the input JSP is redisplayed with the error messages
  • 31. What Does an ActionError Do? ?Used to transport error messages to the user ?Supports internationalization of error messages ?Allows user to be notified of multiple error conditions ?Prevents a cycle of submit, display error, resubmit, display next error…
  • 32. ActionError Relationships Action ActionForm Creates Creates ActionError JSP Displays 0..* ActionErrors
  • 33. ActionError Interactions Client ActionServlet ActionForm JSP 1: Submit 2: Validate 3: new () ActionErrors 4: new () ActionError 5: Add 6: return 7: Forward 8: Get error 9: Get message 10: Display message
  • 34. How Is an ActionError Configured? ?Error messages defined in resource bundle ?ApplicationResources.properties by default ?Can be parameterized with up to five parameters • e.g. error.invalid.date=Date {0} is not valid ?Error header and footer defined ?errors.header and errors.footer ?If present, added before and after error messages
  • 35. Example ActionError - Creation ?Created in ActionForm validate method public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); try { DateFormat.parse(getBirthDate()); } catch (final ParseException parseException) { ActionError error = new ActionError(“error.invalid.date”), getBirthDate()); errors.add(“birthDate”, error); } return errors; }
  • 36. Example ActionError - Creation ?Can also be created in Action perform method ?Generally if business validation is necessary • e.g. Uniqueness of input … try { personDelegate.createPerson(personInfo); } catch (final DuplicatePersonException duplicatePersonException) { ActionErrors errors = new ActionErrors(); ActionError error = new ActionError(“error.duplicate.name”); errors.add(“name”, error); saveErrors(request, errors); return mapping.findForward(mapping.getInput()); }
  • 37. Example ActionError - Display <form method=“post” action=“createPerson”> <table> … <tr> <td>Birthdate</td> <td><input type=“text” name=“birthDate”/></td> </tr> <tr> <td><html:errors/></td> </tr> <tr> <td><input type=“submit” name=“Submit” value=“Create”></td> </tr> </table> </form>
  • 38. Struts 1.1 ActionErrors ?New ActionMessage super class introduced ?Used for more general purpose messages • Action ‘Error’ implies improper to use for informational or warning messages ?Introduction of declarative exception handling ?Allows definition of exception handling policy externally
  • 39. What Is an ActionForm? ?Defines an abstract class for managing forms ?Standard callback for form validation ?Standard callback for resetting a form ?Supports form management by ?Capturing input data ?Validation of form data ?Returning error message on validation failure ?Transferring data to Action class ?Determining which action was submitted • If multiple submits in the form
  • 40. How Is an ActionForm Used? ?Defines accessors and mutators for form being maintained ?Implements validate and reset methods ?Validate performs validation of data • Only called if form configured for validation ?Reset allows recycling of forms ?Two levels of scope – session (default) and request ?Session used to support multi-page wizards ?Form passed into Action class when invoked
  • 41. What Does an ActionForm Do? ?When a form is submitted, the ActionServlet will: ?Detect which ActionForm subclass is associated with the mapping (if any) ?Find an existing instance or instantiate one ?Populate it with form data from the request ?Invoke the ActionForm’s validate method ?Pass the ActionForm instance to the Action instance • If validation successful
  • 42. ActionForm Relationships ActionForm invokes ActionServlet populated from creates JSP displays ActionError ActionErrors
  • 43. ActionForm Interactions Client ActionServlet ActionForm JSP 1: submit 2: validate 3: new () ActionErrors 4: new () ActionError 5: add 6: return 7: forward 8: display errors
  • 44. Example ActionForm public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); try { DateFormat.parse(getBirthDate()); } catch (final ParseException parseException) { errors.add(“birthDate”, new ActionError(“error.invalid.date”), getBirthDate()); } if ((getName() == null) || (getName().equals(“”))) { errors.add(“name”, new ActionError(“error.name.required”)); } return errors; }
  • 45. How Is an ActionForm Configured? <form-beans> <form-bean name=“edit.person.formquot; type=quot;com.redhook.examples.genealogy.web.EditPersonFormquot;/> </form-beans> … <action path=quot;/person/editPersonquot; type=quot;com.redhook.examples.genealogy.web.EditPersonActionquot; name=“edit.person.formquot; scope=quot;requestquot; input=quot;/person/editPerson.jspquot; validate=quot;truequot;> <forward name=“savequot; path=quot;/common/welcome.doquot; redirect=quot;truequot;/> </action>
  • 46. Struts 1.1 ActionForms ?Dynamic Forms introduced ?Configured in configuration file rather than coding ?Version exists that works with validator package to provide automatic validation
  • 47. Struts 1.1 Validation ?Validator framework from Jakarta ?Part of Commons sub-project ?Struts 1.1 includes this by default ?Allows declarative validation for many fields • e.g. Formats ?Dates, Numbers, Email, Credit Card, Postal Codes • Lengths ?Minimum, maximum • Ranges ?Can also be configured for Struts 1.0
  • 48. Struts Resource Management ?Centralizes resource administration for ?Internationalization ?Error treatment ?Standard labeling ?By default ApplicationResources.properties ?Can be changed in web.xml configuration ?Must be located on class path • Typically in WEB-INF/classes
  • 49. ResourceManagement – ApplicationResources.properties # Titles title.welcome=Genealogy Tree # Labels label.first.name=First Name: # Links link.add.person=Add a new person # Resources resource.image.save=/images/save.gif # Errors error.invalid.date=Date {0} is not valid.
  • 50. Struts Resource Management ?Can be accessed from JSP through tag libraries <bean:message key=“label.first.name”/> <html:img pageKey=“resource.image.save”/> ?Can also be accessed in Action objects through MessageResources MessageResources messages = getResources(); Locale locale = getLocale(request); messages.getMessage(“label.namequot;, locale);
  • 51. Struts & TagLibs ?Struts supports four tag libraries ?Not mandatory • Renders cleaner pages • Not limited to these four ?Provides flexible way to • Access application and framework objects under different scopes • Render objects to output stream, handle validation and processing errors • Support internationalization capabilities • Create page templates that support reusable design
  • 52. Struts & TagLibs ?What is required to use them? ?web.xml tag library declaration for each library <taglib> <taglib-uri>/WEB-INF/tlds/struts-bean.tld</taglib-uri> <taglib-location> /WEB-INF/tlds/struts-bean.tld </taglib-location> </taglib> ?Taglib directive on each target page <%@ taglib uri='/WEB-INF/tlds/struts-bean.tld' prefix='bean' %>
  • 53. Bean Tag Library ?Provides ways to access and expose beans and properties in the application ?Provides internationalization functionality ?Includes parametric replacement ?Bean references can be created ?String constants can be defined
  • 54. HTML Tag Library ?Provides support for rendering html controls ?Input controls, images, forms, etc. ?Includes support for: ?JavaScript event handling ?Cascading Style Sheets ?Navigation attributes ?Supports display of errors found during form validation
  • 55. Logic Tag Library ?Conditional generation of content ?Supports comparison properties equality to a constant ?Conditional on presence (or lack) of variables or properties • Includes cookies, roles, etc. ?Navigational forwarding or redirection ?Iteration of collection elements
  • 56. Template Tag Library ?Allows atomic views to be created ?i.e. Section, Header, Footer, Content ?Views can then be added to a defined layout
  • 57. Struts & TagLibs ?Can also use other tag libraries ?Jakarta TagLibs ?JSTL ?Custom Tags ?Struts 1.1 ?Tile TagLib supercedes Template TagLib • Provides more extensive layout support ?Nested TagLib • Extends base Struts Taglibs to support relation to each other in a nested manner
  • 58. Configuration ?Two aspects to Struts configuration ?web.xml ?struts-config.xml
  • 59. Configuration – Web.xml <web-app> <servlet> <servlet-name>action</servlet-name> <servlet-class>org.apache.struts.action.ActionServlet</servlet- class> <init-param> <param-name>application</param-name> <param-value>ApplicationResources</param-value> </init-param> <init-param> <param-name>config</param-name> <param-value>/WEB-INF/struts-config.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> …
  • 60. Configuration – Web.xml <web-app> … <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list>
  • 61. Configuration – Web.xml <web-app> … <taglib> <taglib-uri>/WEB-INF/tlds/struts-bean.tld</taglib-uri> <taglib-location> /WEB-INF/tlds/struts-bean.tld </taglib-location> </taglib> </web-app>
  • 62. Configuration – Struts-config.xml <struts-config> <form-beans> <form-bean name=quot;edit.person.formquot; type=quot;com.redhook.examples.genealogy.web.EditPersonFormquot;/> </form-beans> <global-forwards> <forward name=quot;welcomequot; path=quot;/common/welcome.doquot; redirect=quot;truequot;/> </global-forwards> <action-mappings> <action path=quot;/person/editPersonquot; type=quot;com.redhook.examples.genealogy.web.EditPersonActionquot; name=quot;edit.person.formquot; scope=quot;requestquot; input=quot;/person/editPerson.jspquot; validate=quot;truequot;> <forward name=quot;savequot; path=quot;/common/welcome.doquot; redirect=quot;truequot;/> </action> </action-mappings> </struts-config>
  • 63. Configuration – Struts-config.xml <struts-config> <form-beans> <form-bean name=“edit.person.formquot; type=quot;com.redhook.examples.genealogy.web.EditPersonFormquot;/> </form-beans> <global-forwards> <forward name=quot;welcomequot; path=quot;/common/welcome.doquot; redirect=quot;truequot;/> </global-forwards> <action-mappings> <action path=quot;/person/editPersonquot; type=quot;com.redhook.examples.genealogy.web.EditPersonActionquot; scope=quot;requestquot; name=“edit.person.formquot; input=quot;/person/editPerson.jspquot; validate=quot;truequot;> <forward name=quot;savequot; path=quot;/common/welcome.doquot; redirect=quot;truequot;/> </action> </action-mappings> </struts-config>
  • 64. Configuration – Struts-config.xml <struts-config> <form-beans> <form-bean name=quot;edit.person.formquot; type=quot;com.redhook.examples.genealogy.web.EditPersonFormquot;/> </form-beans> <global-forwards> <forward name=quot;welcomequot; path=quot;/common/welcome.doquot; redirect=quot;truequot;/> </global-forwards> <action-mappings> <action path=quot;/person/editPersonquot; type=quot;com.redhook.examples.genealogy.web.EditPersonActionquot; scope=quot;requestquot; name=quot;edit.person.formquot; input=quot;/person/editPerson.jspquot; validate=quot;truequot;> <forward name=quot;savequot; path=quot;/common/welcome.doquot; redirect=quot;truequot;/> </action> </action-mappings> </struts-config>
  • 65. Struts 1.1 Configuration ?Adds support for ?Multiple application modules ?Declarative exceptions ?Plug in elements ?Multiple message resource elements ?Visual configuration tools can also be found ?Both commercial and open-source • http://jakarta.apache.org/struts/resources/guis.html
  • 66. Logging ?Important aspect of applications ?3rd party logging frameworks used pre JDK 1.4 • i.e. log4j ?Logging API introduced with JDK 1.4 • Similar to log4j ?Hierarchical categories ?Logging levels
  • 67. Logging ?What does Struts provide? ?Nothing ?Jakarta project provides thin logging wrapper ?Part of Commons subproject ?Provides wrappers for standard logging frameworks • JDK 1.4, log4j, etc. ?Can also develop wrapper for custom logging API
  • 68. Logging ?Why use Jakarta Common Logging? ?Can declaratively switch logging frameworks ?Implementation wrapper class declared in a properties file ?Must still configure logging framework in typical way ?i.e. log4j.properties ?Jakarta also provides logging tag library ?Useful for debugging • Allows dump of scope attributes
  • 69. Resources ?JSP and Tag Libraries for Web Development by Wellington L.S. da Silva, New Riders Publishing ISBN: 0-73571-095-3 ?Programming Jakarta Struts By Chuck Cavaness, O’Reilly & Associates (October 2002) ISBN: 0-59600-328-5 ?Struts in Action: A Practical Guide to the Leading Java Web Framework by Ted Husted et al., Manning Publications Company ISBN: 1930110502
  • 70. Websites ? http://jakarta.apache.org/struts/index.html ? http://www.husted.com/struts ? Sample app can be found at: ? http://www.redhookgroup.com/downloads/css/genealogy.zip ?Thank you. ?Any questions ?andrew@redhookgroup.com