SlideShare une entreprise Scribd logo
1  sur  11
Télécharger pour lire hors ligne
Jakarta Struts:
  An MVC Framework
       Overview, Installation,
    and Setup. Struts 1.2 Version.
      Core Servlets & JSP book: www.coreservlets.com
      More Servlets & JSP book: www.moreservlets.com
  Servlet/JSP/Struts/JSF Training: courses.coreservlets.com
  Slides © Marty Hall, http://www.coreservlets.com, books © Sun Microsystems Press




   For live Struts training, please see
JSP/servlet/Struts/JSF training courses at
    http://courses.coreservlets.com/.
   Taught by the author of Core Servlets and JSP, More
  Servlets and JSP, and this tutorial. Available at public
  venues, or customized versions can be held on-site at
                    your organization.
  Slides © Marty Hall, http://www.coreservlets.com, books © Sun Microsystems Press
Agenda
    • Understanding Struts
       – Different views of Struts
       – Advantages of Struts
       – Disadvantages of Struts
    • Setting Up Struts
       –    Downloading and configuring Struts 1.2
       –    Testing Struts
       –    Setting up Struts applications
       –    Accessing Struts documentation
       –    Adding Struts to an existing Web application



4    Apache Struts: Intro and Setup                  www.coreservlets.com




    What is Apache Struts?
    • An MVC Framework?
       – Struts provides a unified framework for deploying servlet
         and JSP applications that use the MVC architecture.
    • A Collection of Utilities?
       – Struts provides utility classes to handle many of the most
         common tasks in Web application development
    • A Set of JSP Custom Tag Libraries?
       – Struts provides custom tag libraries for outputting bean
         properties, generating HTML forms, iterating over
         various types of data structures, and conditionally
         outputting HTML.
    • But which is the proper way to view Struts?
       – The answer depends on what you are going to use it for,
         but the MVC framework is the most common way of
         looking at Struts.
5    Apache Struts: Intro and Setup                  www.coreservlets.com
Advantages of Struts (vs. MVC
     Using RequestDispatcher)
    • Centralized file-based configuration
        – Rather then hard-coding information into Java programs, many
          Struts values are represented in XML or property files. This loose
          coupling means that many changes can be made without modifying
          or recompiling Java code, and that wholesale changes can be made
          by editing a single file. This approach also lets Java and Web
          developers focus on their specific tasks (implementing business
          logic, presenting certain values to clients, etc.) without needing to
          know about the overall system layout.
    • Form beans
        – In JSP, you can use property=quot;*quot; with jsp:setProperty to
          automatically populate a JavaBean component based on incoming
          request parameters. Apache Struts extends this capability to Java
          code and adds in several useful utilities, all of which serve to greatly
          simplify the processing of request parameters.
    • Bean tags
        – Apache Struts provides a set of custom JSP tags (bean:write, in
             particular) that let you easily output the properties of JavaBeans
             components. Basically, these are concise and powerful variations of
6     Apache the standard jsp:useBean and jsp:getProperty tags. www.coreservlets.com
             Struts: Intro and Setup




     Advantages of Struts (vs.
     Standard MVC), Continued
    • HTML tags
        – Apache Struts provides a set of custom JSP tags to create HTML
          forms that are associated with JavaBeans components. This
          bean/form association serves two useful purposes:
                • It lets you get initial form-field values from Java objects.
                • It lets you redisplay forms with some or all previously entered values
                  intact.
    • Form field validation
        – Apache Struts has builtin capabilities for checking that form values
          are in the required format. If values are missing or in an improper
          format, the form can be automatically redisplayed with error
          messages and with the previously entered values maintained.
                • This validation can be performed on the server (in Java), or both on the
                  server and on the client (in JavaScript).
    • Consistent approach
        – Struts encourages consistent use of MVC throughout your
          application.
7     Apache Struts: Intro and Setup                                  www.coreservlets.com
Disadvantages of Struts (vs.
    MVC with RequestDispatcher)
    • Bigger learning curve
       – To use MVC with the standard RequestDispatcher, you
         need to be comfortable with the standard JSP and servlet
         APIs. To use MVC with Struts, you have to be
         comfortable with the standard JSP and servlet APIs and a
         large and elaborate framework that is almost equal in size
         to the core system. This drawback is especially
         significant with smaller projects, near-term deadlines, and
         less experienced developers; you could spend as much
         time learning Struts as building your actual system.
    • Worse documentation
       – Compared to the standard servlet and JSP APIs, Struts
         has fewer online resources, and many first-time users find
         the online Apache documentation confusing and poorly
         organized. There are also fewer books on Apache Struts
         than on standard servlets and JSP.
8    Apache Struts: Intro and Setup                  www.coreservlets.com




    Disadvantages of Struts (vs.
    Standard MVC), Continued
    • Less transparent
       – With Struts applications, there is a lot more going on
         behind the scenes than with normal Java-based Web
         applications. As a result, Struts applications are:
               • Harder to understand
               • Harder to benchmark and optimize
    • Rigid approach
       – The flip side of the benefit that Struts encourages a
         consistent approach to MVC is that Struts makes it
         difficult (but by no means impossible) to use other
         approaches.



9    Apache Struts: Intro and Setup                  www.coreservlets.com
Downloading and Configuring
      Struts
     • Download the Struts zip file
         – Start at http://jakarta.apache.org/site/binindex.cgi, or follow the link
           from http://jakarta.apache.org/struts/.
     • Unzip into a directory of your choice
         – For example, unzip into C:jakarta-struts-1.2.4. I'll refer to this
           location as struts_install_dir.
     • Update your CLASSPATH
         – Add struts_install_dir/lib/struts.jar to the CLASSPATH used by
           your compiler or IDE (not your server).
     • Install an XML parser
         – If you have JDK 1.4 or Apache Tomcat, this step is not necessary,
           since they already come with an XML parser. But, if you use JDK
           1.2 or 1.3 with another server, you might need to obtain the XML
           parsing libraries. Here are two good sources:
                 • http://xml.apache.org/
                 • http://java.sun.com/xml/
10     Apache Struts: Intro and Setup                            www.coreservlets.com




      Testing Struts
     • Install struts-blank.war.
         – Install the Web application from
           struts_install_dir/webapps/struts-blank.war on your
           server. For example, with Apache Tomcat, copy
           struts_install_dir/webapps/struts-blank.war to
           tomcat_install_dir/webapps/.
     • Start or restart the server.
         – Most servers only recognize new Web apps when the
           server is started.
     • Access http://localhost/struts-blank/.
         – This URL assumes you are running the server on your
           desktop and are using port 80. In general, access
           http://hostname:port/struts-blank/.
11     Apache Struts: Intro and Setup                            www.coreservlets.com
Testing Struts (Results)




12    Apache Struts: Intro and Setup                      www.coreservlets.com




     Setting Up Struts Applications
     • Option 1 (Good): Copy/rename the struts-blank
       directory to your development directory.
        – When you tested your Struts installation, you ran the
          struts-blank Web app. When you did so, Tomcat and
          most other servers unpacked the struts-blank.war file into
          the struts-blank directory. So, copy that directory to
          whatever location you use for developing custom Web
          apps, and rename it to whatever app name you choose.
        – For example, if you are using Tomcat and
          C:Servlets+JSP is the location you use for development,
          copy the tomcat_install_dir/webapps/struts-blank
          directory to C:Servlets+JSP, rename it to struts-test,
          resulting in C:Servlets+JSPstruts-test.
        – Note: the index.jsp in struts-blank should be replaced
13
          with your own version.
      Apache Struts: Intro and Setup                   www.coreservlets.com
Setting Up Struts Applications
     • Option 2 (Good): Unjar struts-blank.war into
       your development directory.
         – If your server doesn't automatically unpack WAR files,
           then even if you ran the struts-blank test described above,
           you have no regular directory to work with. Besides,
           some people prefer to unpack the WAR file themselves
           anyhow. To do so:
                 • Copy struts_install_dir/webapps/struts-blank.war to your
                   development directory.
                 • Make a new directory (e.g., called struts-test).
                 • Unjar struts-blank.war into that directory You can use jar -xvf or
                   a standard zip tool like WinZip or the Windows XP explorer.
                 • Whenever you want to test your application, copy struts-test to
                   the server's Web application autodeploy directory (e.g., onto the
                   shortcut to tomcat_install_dir/webapps).
                         – Again, remember to replace the index.jsp page in struts-blank
14     Apache Struts: Intro and Setup                                               www.coreservlets.com




      Setting Up Struts Applications
     • Option 3 (Bad): Rename struts-blank and leave it in the
       server's deployment directory.
         – It is quite common to work directly in server's deployment directory
           (e.g., to work directly in tomcat_install_dir/webapps/struts-test).
           However, this approach scales poorly to real applications, makes it
           harder to test changes (you have no stable working version), and
           doesn't support your quot;realquot; deployment server anyhow (which is
           almost certainly not your desktop machine). If you don't have a
           good deployment system using your IDE or ant scripts, you can
           easily make a shortcut (Windows) or symbolic link (Unix/Linux) to
           the server's autodeploy directory, and just copy the Web app onto
           the shortcut each time. For example:
                 • Grab tomcat_install_dir/webapps with your right mouse,
                     drag it into devel_dir, release, and choose quot;Create
                     Shortcut Herequot;.
                 • Create struts-test or other applications as subdirectories
                     within devel_dir, as described above.
                 • Deploy by using the right mouse to drag struts-test onto
15
                     the shortcut from step 1, releasing, and choosing quot;Copyquot;.
       Apache Struts: Intro and Setup                           www.coreservlets.com
Accessing Struts
      Documentation
     • Read a local copy
         – This is fastest, but the documentation can get a bit out of
           date. To read a local copy, install the
           struts-documentation.war Web app. Copy
           struts_install_dir/webapps/struts-documentation.war to
           tomcat_install_dir/webapps, restart server, and use the
           URL http://localhost/struts-documentation/.
     • Read it from the Apache site
         – This option is slower, but guarantees that you get the
           latest versions of the documentation. Use
           http://struts.apache.org/learning.html.
         – The documentation includes FAQs, user guides, tutorials,
           and the API in Javadoc format.

16     Apache Struts: Intro and Setup                             www.coreservlets.com




      Adding Struts to an Existing
      Web Application
     • Copy files into your Web app
         – Copy JAR files from struts-blank/WEB-INF/lib to
           your_web_app/WEB-INF/lib.
         – Copy TLD files from struts-blank/WEB-INF to
           your_web_app/WEB-INF.
         – Copy struts-config.xml from struts-blank/WEB-INF to
           your_web_app/WEB-INF.
         – Copy the application properties file from struts-blank/WEB-
           INF/classes/resources to your_web_app/WEB-
           INF/classes/resources.
         – If you plan on using the automatic validator, copy validation.xml
           and validator-rules.xml from struts-blank/WEB-INF to
           your_web_app/WEB-INF.
         – If you plan on using Tiles, copy struts-tiles.xml from struts-
           blank/WEB-INF to your_web_app/WEB-INF.
     • Update web.xml
         – Copy declarations out of struts-blank/WEB-INF/web.xml into
              your_web_app/WEB-INF/web.xml. Most importantly, copy the
              servlet and servlet-mapping entries that map *.do to
17     Apache org.apache.struts.action.ActionServlet.
              Struts: Intro and Setup                            www.coreservlets.com
Some Struts Sites: Travel




18   Apache Struts: Intro and Setup   www.coreservlets.com




     Some Struts Sites: Government




19   Apache Struts: Intro and Setup   www.coreservlets.com
Some Struts Sites: Commercial




20   Apache Struts: Intro and Setup   www.coreservlets.com




     Struts is Mainstream:
     Conservatives and Liberals Use It




21   Apache Struts: Intro and Setup   www.coreservlets.com
Summary
     • Struts is an MVC framework
        – Also a collection of utilities and custom tag libraries
     • Struts has significant advantages, but adds
       significant complexity
        – Compare the use of Struts to the use of normal MVC
          (especially with the JSP 2.0 expression language)
        – Also consider other frameworks, especially JavaServer
          Faces (JSF).
     • Struts is pretty widely used
     • Test by deploying struts-blank.war
     • Develop by copying the struts-blank directory
        – Don't start from scratch; too many changes needed in
          your Web app
22    Apache Struts: Intro and Setup                                         www.coreservlets.com




                                       Questions?

                         Core Servlets & JSP book: www.coreservlets.com
                         More Servlets & JSP book: www.moreservlets.com
                        Servlet, JSP, Struts, JSF, and Java Training Courses:
                                      courses.coreservlets.com
                    Slides © Marty Hall, http://www.coreservlets.com, books © Sun Microsystems Press

Contenu connexe

Tendances

Spring boot for buidling microservices
Spring boot for buidling microservicesSpring boot for buidling microservices
Spring boot for buidling microservicesNilanjan Roy
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring BootTrey Howard
 
Architecting Large Enterprise Java Projects
Architecting Large Enterprise Java ProjectsArchitecting Large Enterprise Java Projects
Architecting Large Enterprise Java ProjectsMarkus Eisele
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot IntroductionJeevesh Pandey
 
Step by Step Guide for building a simple Struts Application
Step by Step Guide for building a simple Struts ApplicationStep by Step Guide for building a simple Struts Application
Step by Step Guide for building a simple Struts Applicationelliando dias
 
How to use bean as datasource in database connector
How to use bean as datasource in database connectorHow to use bean as datasource in database connector
How to use bean as datasource in database connectorRaviRajuRamaKrishna
 
Arpita industrial trainingppt
Arpita industrial trainingpptArpita industrial trainingppt
Arpita industrial trainingpptARPITA SRIVASTAVA
 
JEE Programming - 08 Enterprise Application Deployment
JEE Programming - 08 Enterprise Application DeploymentJEE Programming - 08 Enterprise Application Deployment
JEE Programming - 08 Enterprise Application DeploymentDanairat Thanabodithammachari
 
Riga Dev Day - Automated Android Continuous Integration
Riga Dev Day - Automated Android Continuous IntegrationRiga Dev Day - Automated Android Continuous Integration
Riga Dev Day - Automated Android Continuous IntegrationNicolas Fränkel
 
Servlet.ppt
Servlet.pptServlet.ppt
Servlet.pptVMahesh5
 
RESTful web service with JBoss Fuse
RESTful web service with JBoss FuseRESTful web service with JBoss Fuse
RESTful web service with JBoss Fuseejlp12
 
Java EE 7 - Into the Cloud
Java EE 7 - Into the CloudJava EE 7 - Into the Cloud
Java EE 7 - Into the CloudMarkus Eisele
 
Ehcache3 — JSR-107 on steroids
Ehcache3 — JSR-107 on steroidsEhcache3 — JSR-107 on steroids
Ehcache3 — JSR-107 on steroidsAlex Snaps
 

Tendances (16)

Spring boot for buidling microservices
Spring boot for buidling microservicesSpring boot for buidling microservices
Spring boot for buidling microservices
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
 
Architecting Large Enterprise Java Projects
Architecting Large Enterprise Java ProjectsArchitecting Large Enterprise Java Projects
Architecting Large Enterprise Java Projects
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot Introduction
 
Step by Step Guide for building a simple Struts Application
Step by Step Guide for building a simple Struts ApplicationStep by Step Guide for building a simple Struts Application
Step by Step Guide for building a simple Struts Application
 
How to use bean as datasource in database connector
How to use bean as datasource in database connectorHow to use bean as datasource in database connector
How to use bean as datasource in database connector
 
JEE Programming - 04 Java Servlets
JEE Programming - 04 Java ServletsJEE Programming - 04 Java Servlets
JEE Programming - 04 Java Servlets
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
 
Arpita industrial trainingppt
Arpita industrial trainingpptArpita industrial trainingppt
Arpita industrial trainingppt
 
JEE Programming - 08 Enterprise Application Deployment
JEE Programming - 08 Enterprise Application DeploymentJEE Programming - 08 Enterprise Application Deployment
JEE Programming - 08 Enterprise Application Deployment
 
Riga Dev Day - Automated Android Continuous Integration
Riga Dev Day - Automated Android Continuous IntegrationRiga Dev Day - Automated Android Continuous Integration
Riga Dev Day - Automated Android Continuous Integration
 
Servlet.ppt
Servlet.pptServlet.ppt
Servlet.ppt
 
RESTful web service with JBoss Fuse
RESTful web service with JBoss FuseRESTful web service with JBoss Fuse
RESTful web service with JBoss Fuse
 
Java EE 7 - Into the Cloud
Java EE 7 - Into the CloudJava EE 7 - Into the Cloud
Java EE 7 - Into the Cloud
 
Java servlets
Java servletsJava servlets
Java servlets
 
Ehcache3 — JSR-107 on steroids
Ehcache3 — JSR-107 on steroidsEhcache3 — JSR-107 on steroids
Ehcache3 — JSR-107 on steroids
 

En vedette

1 java servlets and jsp
1   java servlets and jsp1   java servlets and jsp
1 java servlets and jspAnkit Minocha
 
Software Testing Basics
Software Testing BasicsSoftware Testing Basics
Software Testing BasicsBelal Raslan
 
Rising Asia - Inaugural Issue, April 2015
Rising Asia - Inaugural Issue, April 2015Rising Asia - Inaugural Issue, April 2015
Rising Asia - Inaugural Issue, April 2015Rumman Ahamed
 
Open stack in action cern _openstack_accelerating_science
Open stack in action  cern _openstack_accelerating_scienceOpen stack in action  cern _openstack_accelerating_science
Open stack in action cern _openstack_accelerating_scienceeNovance
 
Mikhail Gromov - How Does He Do It?
Mikhail Gromov - How Does He Do It?Mikhail Gromov - How Does He Do It?
Mikhail Gromov - How Does He Do It?simonsfoundation
 
Q3 2013 ASSA ABLOY investors presentation 28 october
Q3 2013 ASSA ABLOY investors presentation 28 octoberQ3 2013 ASSA ABLOY investors presentation 28 october
Q3 2013 ASSA ABLOY investors presentation 28 octoberASSA ABLOY
 
CV_Zhang Haochenzi 2015:10:08
CV_Zhang Haochenzi 2015:10:08CV_Zhang Haochenzi 2015:10:08
CV_Zhang Haochenzi 2015:10:08haochenzi zhang
 
Respeaking as a part of translation and interpreting curriculum
Respeaking as a part of translation and interpreting curriculumRespeaking as a part of translation and interpreting curriculum
Respeaking as a part of translation and interpreting curriculumUniversity of Warsaw
 
Asat book0-fresh blood
Asat book0-fresh bloodAsat book0-fresh blood
Asat book0-fresh bloodAshraf Ali
 
What's a Good Chinese Daily Deal - A Market Analysis - May 2011 - Dataotuan.com
What's a Good Chinese Daily Deal - A Market Analysis - May 2011 - Dataotuan.com What's a Good Chinese Daily Deal - A Market Analysis - May 2011 - Dataotuan.com
What's a Good Chinese Daily Deal - A Market Analysis - May 2011 - Dataotuan.com dataotuan
 
SERTIFIKAT HSE EXPRESS
SERTIFIKAT HSE EXPRESSSERTIFIKAT HSE EXPRESS
SERTIFIKAT HSE EXPRESSsertifikatSMK3
 
Project 2016 progress template 25% completed
Project 2016 progress template  25% completedProject 2016 progress template  25% completed
Project 2016 progress template 25% completedThomas Wheeler
 
Are you good at doing sports?
Are you good at doing sports?Are you good at doing sports?
Are you good at doing sports?onlychild21
 
MS Foods Plan A Quarterly Newsletter February 2016
MS Foods Plan A Quarterly Newsletter February 2016MS Foods Plan A Quarterly Newsletter February 2016
MS Foods Plan A Quarterly Newsletter February 2016Ray McCreadie
 
5 kinesis lightning
5 kinesis lightning5 kinesis lightning
5 kinesis lightningBigDataCamp
 

En vedette (20)

1 java servlets and jsp
1   java servlets and jsp1   java servlets and jsp
1 java servlets and jsp
 
Software Testing Basics
Software Testing BasicsSoftware Testing Basics
Software Testing Basics
 
Rising Asia - Inaugural Issue, April 2015
Rising Asia - Inaugural Issue, April 2015Rising Asia - Inaugural Issue, April 2015
Rising Asia - Inaugural Issue, April 2015
 
Open stack in action cern _openstack_accelerating_science
Open stack in action  cern _openstack_accelerating_scienceOpen stack in action  cern _openstack_accelerating_science
Open stack in action cern _openstack_accelerating_science
 
Mikhail Gromov - How Does He Do It?
Mikhail Gromov - How Does He Do It?Mikhail Gromov - How Does He Do It?
Mikhail Gromov - How Does He Do It?
 
Cob 20081113 1
Cob 20081113 1Cob 20081113 1
Cob 20081113 1
 
Q3 2013 ASSA ABLOY investors presentation 28 october
Q3 2013 ASSA ABLOY investors presentation 28 octoberQ3 2013 ASSA ABLOY investors presentation 28 october
Q3 2013 ASSA ABLOY investors presentation 28 october
 
The pharaoh’s curses—the constraint from god
The pharaoh’s curses—the constraint from godThe pharaoh’s curses—the constraint from god
The pharaoh’s curses—the constraint from god
 
CV_Zhang Haochenzi 2015:10:08
CV_Zhang Haochenzi 2015:10:08CV_Zhang Haochenzi 2015:10:08
CV_Zhang Haochenzi 2015:10:08
 
Dorissss
DorissssDorissss
Dorissss
 
Statement to Guardian
Statement to GuardianStatement to Guardian
Statement to Guardian
 
Respeaking as a part of translation and interpreting curriculum
Respeaking as a part of translation and interpreting curriculumRespeaking as a part of translation and interpreting curriculum
Respeaking as a part of translation and interpreting curriculum
 
Jacobiano
JacobianoJacobiano
Jacobiano
 
Asat book0-fresh blood
Asat book0-fresh bloodAsat book0-fresh blood
Asat book0-fresh blood
 
What's a Good Chinese Daily Deal - A Market Analysis - May 2011 - Dataotuan.com
What's a Good Chinese Daily Deal - A Market Analysis - May 2011 - Dataotuan.com What's a Good Chinese Daily Deal - A Market Analysis - May 2011 - Dataotuan.com
What's a Good Chinese Daily Deal - A Market Analysis - May 2011 - Dataotuan.com
 
SERTIFIKAT HSE EXPRESS
SERTIFIKAT HSE EXPRESSSERTIFIKAT HSE EXPRESS
SERTIFIKAT HSE EXPRESS
 
Project 2016 progress template 25% completed
Project 2016 progress template  25% completedProject 2016 progress template  25% completed
Project 2016 progress template 25% completed
 
Are you good at doing sports?
Are you good at doing sports?Are you good at doing sports?
Are you good at doing sports?
 
MS Foods Plan A Quarterly Newsletter February 2016
MS Foods Plan A Quarterly Newsletter February 2016MS Foods Plan A Quarterly Newsletter February 2016
MS Foods Plan A Quarterly Newsletter February 2016
 
5 kinesis lightning
5 kinesis lightning5 kinesis lightning
5 kinesis lightning
 

Similaire à 01 Struts Intro

Struts 2 Overview
Struts 2 OverviewStruts 2 Overview
Struts 2 Overviewskill-guru
 
Struts2-Spring=Hibernate
Struts2-Spring=HibernateStruts2-Spring=Hibernate
Struts2-Spring=HibernateJay Shah
 
Jsp and Servlets
Jsp and ServletsJsp and Servlets
Jsp and ServletsRaghu nath
 
Struts Interview Questions
Struts Interview QuestionsStruts Interview Questions
Struts Interview Questionsjbashask
 
192563547-Servletsjhb,mnjhjhjm,nm,-Pres-ppt.ppt
192563547-Servletsjhb,mnjhjhjm,nm,-Pres-ppt.ppt192563547-Servletsjhb,mnjhjhjm,nm,-Pres-ppt.ppt
192563547-Servletsjhb,mnjhjhjm,nm,-Pres-ppt.pptsindhu991994
 
01 overview-and-setup
01 overview-and-setup01 overview-and-setup
01 overview-and-setupsnopteck
 
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
 
Java servlet technology
Java servlet technologyJava servlet technology
Java servlet technologyMinal Maniar
 
Ppt for Online music store
Ppt for Online music storePpt for Online music store
Ppt for Online music storeADEEBANADEEM
 
BITM3730Week12.pptx
BITM3730Week12.pptxBITM3730Week12.pptx
BITM3730Week12.pptxMattMarino13
 
Advance Java Topics (J2EE)
Advance Java Topics (J2EE)Advance Java Topics (J2EE)
Advance Java Topics (J2EE)slire
 
Programming Server side with Sevlet
 Programming Server side with Sevlet  Programming Server side with Sevlet
Programming Server side with Sevlet backdoor
 
Chapter 3 servlet & jsp
Chapter 3 servlet & jspChapter 3 servlet & jsp
Chapter 3 servlet & jspJafar Nesargi
 
Web container and Apache Tomcat
Web container and Apache TomcatWeb container and Apache Tomcat
Web container and Apache TomcatAuwal Amshi
 

Similaire à 01 Struts Intro (20)

Jakarta struts
Jakarta strutsJakarta struts
Jakarta struts
 
Struts Interceptors
Struts InterceptorsStruts Interceptors
Struts Interceptors
 
Struts 2 Overview
Struts 2 OverviewStruts 2 Overview
Struts 2 Overview
 
Struts2-Spring=Hibernate
Struts2-Spring=HibernateStruts2-Spring=Hibernate
Struts2-Spring=Hibernate
 
Jsp and jstl
Jsp and jstlJsp and jstl
Jsp and jstl
 
Jsp and Servlets
Jsp and ServletsJsp and Servlets
Jsp and Servlets
 
Mvc15 (1)
Mvc15 (1)Mvc15 (1)
Mvc15 (1)
 
Struts Interview Questions
Struts Interview QuestionsStruts Interview Questions
Struts Interview Questions
 
AJppt.pptx
AJppt.pptxAJppt.pptx
AJppt.pptx
 
192563547-Servletsjhb,mnjhjhjm,nm,-Pres-ppt.ppt
192563547-Servletsjhb,mnjhjhjm,nm,-Pres-ppt.ppt192563547-Servletsjhb,mnjhjhjm,nm,-Pres-ppt.ppt
192563547-Servletsjhb,mnjhjhjm,nm,-Pres-ppt.ppt
 
01 overview-and-setup
01 overview-and-setup01 overview-and-setup
01 overview-and-setup
 
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
 
Java servlet technology
Java servlet technologyJava servlet technology
Java servlet technology
 
Ppt for Online music store
Ppt for Online music storePpt for Online music store
Ppt for Online music store
 
BITM3730Week12.pptx
BITM3730Week12.pptxBITM3730Week12.pptx
BITM3730Week12.pptx
 
Advance Java Topics (J2EE)
Advance Java Topics (J2EE)Advance Java Topics (J2EE)
Advance Java Topics (J2EE)
 
Programming Server side with Sevlet
 Programming Server side with Sevlet  Programming Server side with Sevlet
Programming Server side with Sevlet
 
JavaEE6 my way
JavaEE6 my wayJavaEE6 my way
JavaEE6 my way
 
Chapter 3 servlet & jsp
Chapter 3 servlet & jspChapter 3 servlet & jsp
Chapter 3 servlet & jsp
 
Web container and Apache Tomcat
Web container and Apache TomcatWeb container and Apache Tomcat
Web container and Apache Tomcat
 

Dernier

Creating Low-Code Loan Applications using the Trisotech Mortgage Feature Set
Creating Low-Code Loan Applications using the Trisotech Mortgage Feature SetCreating Low-Code Loan Applications using the Trisotech Mortgage Feature Set
Creating Low-Code Loan Applications using the Trisotech Mortgage Feature SetDenis Gagné
 
Call Girls In Panjim North Goa 9971646499 Genuine Service
Call Girls In Panjim North Goa 9971646499 Genuine ServiceCall Girls In Panjim North Goa 9971646499 Genuine Service
Call Girls In Panjim North Goa 9971646499 Genuine Serviceritikaroy0888
 
It will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 MayIt will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 MayNZSG
 
VIP Kolkata Call Girl Howrah 👉 8250192130 Available With Room
VIP Kolkata Call Girl Howrah 👉 8250192130  Available With RoomVIP Kolkata Call Girl Howrah 👉 8250192130  Available With Room
VIP Kolkata Call Girl Howrah 👉 8250192130 Available With Roomdivyansh0kumar0
 
Regression analysis: Simple Linear Regression Multiple Linear Regression
Regression analysis:  Simple Linear Regression Multiple Linear RegressionRegression analysis:  Simple Linear Regression Multiple Linear Regression
Regression analysis: Simple Linear Regression Multiple Linear RegressionRavindra Nath Shukla
 
Best VIP Call Girls Noida Sector 40 Call Me: 8448380779
Best VIP Call Girls Noida Sector 40 Call Me: 8448380779Best VIP Call Girls Noida Sector 40 Call Me: 8448380779
Best VIP Call Girls Noida Sector 40 Call Me: 8448380779Delhi Call girls
 
Eni 2024 1Q Results - 24.04.24 business.
Eni 2024 1Q Results - 24.04.24 business.Eni 2024 1Q Results - 24.04.24 business.
Eni 2024 1Q Results - 24.04.24 business.Eni
 
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesMysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesDipal Arora
 
Ensure the security of your HCL environment by applying the Zero Trust princi...
Ensure the security of your HCL environment by applying the Zero Trust princi...Ensure the security of your HCL environment by applying the Zero Trust princi...
Ensure the security of your HCL environment by applying the Zero Trust princi...Roland Driesen
 
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service AvailableCall Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service AvailableDipal Arora
 
BEST ✨ Call Girls In Indirapuram Ghaziabad ✔️ 9871031762 ✔️ Escorts Service...
BEST ✨ Call Girls In  Indirapuram Ghaziabad  ✔️ 9871031762 ✔️ Escorts Service...BEST ✨ Call Girls In  Indirapuram Ghaziabad  ✔️ 9871031762 ✔️ Escorts Service...
BEST ✨ Call Girls In Indirapuram Ghaziabad ✔️ 9871031762 ✔️ Escorts Service...noida100girls
 
A DAY IN THE LIFE OF A SALESMAN / WOMAN
A DAY IN THE LIFE OF A  SALESMAN / WOMANA DAY IN THE LIFE OF A  SALESMAN / WOMAN
A DAY IN THE LIFE OF A SALESMAN / WOMANIlamathiKannappan
 
Vip Dewas Call Girls #9907093804 Contact Number Escorts Service Dewas
Vip Dewas Call Girls #9907093804 Contact Number Escorts Service DewasVip Dewas Call Girls #9907093804 Contact Number Escorts Service Dewas
Vip Dewas Call Girls #9907093804 Contact Number Escorts Service Dewasmakika9823
 
Catalogue ONG NƯỚC uPVC - HDPE DE NHAT.pdf
Catalogue ONG NƯỚC uPVC - HDPE DE NHAT.pdfCatalogue ONG NƯỚC uPVC - HDPE DE NHAT.pdf
Catalogue ONG NƯỚC uPVC - HDPE DE NHAT.pdfOrient Homes
 
Monte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSMMonte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSMRavindra Nath Shukla
 
Monthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptxMonthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptxAndy Lambert
 
Socio-economic-Impact-of-business-consumers-suppliers-and.pptx
Socio-economic-Impact-of-business-consumers-suppliers-and.pptxSocio-economic-Impact-of-business-consumers-suppliers-and.pptx
Socio-economic-Impact-of-business-consumers-suppliers-and.pptxtrishalcan8
 
M.C Lodges -- Guest House in Jhang.
M.C Lodges --  Guest House in Jhang.M.C Lodges --  Guest House in Jhang.
M.C Lodges -- Guest House in Jhang.Aaiza Hassan
 

Dernier (20)

Best Practices for Implementing an External Recruiting Partnership
Best Practices for Implementing an External Recruiting PartnershipBest Practices for Implementing an External Recruiting Partnership
Best Practices for Implementing an External Recruiting Partnership
 
Creating Low-Code Loan Applications using the Trisotech Mortgage Feature Set
Creating Low-Code Loan Applications using the Trisotech Mortgage Feature SetCreating Low-Code Loan Applications using the Trisotech Mortgage Feature Set
Creating Low-Code Loan Applications using the Trisotech Mortgage Feature Set
 
Call Girls In Panjim North Goa 9971646499 Genuine Service
Call Girls In Panjim North Goa 9971646499 Genuine ServiceCall Girls In Panjim North Goa 9971646499 Genuine Service
Call Girls In Panjim North Goa 9971646499 Genuine Service
 
It will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 MayIt will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 May
 
VIP Kolkata Call Girl Howrah 👉 8250192130 Available With Room
VIP Kolkata Call Girl Howrah 👉 8250192130  Available With RoomVIP Kolkata Call Girl Howrah 👉 8250192130  Available With Room
VIP Kolkata Call Girl Howrah 👉 8250192130 Available With Room
 
Nepali Escort Girl Kakori \ 9548273370 Indian Call Girls Service Lucknow ₹,9517
Nepali Escort Girl Kakori \ 9548273370 Indian Call Girls Service Lucknow ₹,9517Nepali Escort Girl Kakori \ 9548273370 Indian Call Girls Service Lucknow ₹,9517
Nepali Escort Girl Kakori \ 9548273370 Indian Call Girls Service Lucknow ₹,9517
 
Regression analysis: Simple Linear Regression Multiple Linear Regression
Regression analysis:  Simple Linear Regression Multiple Linear RegressionRegression analysis:  Simple Linear Regression Multiple Linear Regression
Regression analysis: Simple Linear Regression Multiple Linear Regression
 
Best VIP Call Girls Noida Sector 40 Call Me: 8448380779
Best VIP Call Girls Noida Sector 40 Call Me: 8448380779Best VIP Call Girls Noida Sector 40 Call Me: 8448380779
Best VIP Call Girls Noida Sector 40 Call Me: 8448380779
 
Eni 2024 1Q Results - 24.04.24 business.
Eni 2024 1Q Results - 24.04.24 business.Eni 2024 1Q Results - 24.04.24 business.
Eni 2024 1Q Results - 24.04.24 business.
 
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesMysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
 
Ensure the security of your HCL environment by applying the Zero Trust princi...
Ensure the security of your HCL environment by applying the Zero Trust princi...Ensure the security of your HCL environment by applying the Zero Trust princi...
Ensure the security of your HCL environment by applying the Zero Trust princi...
 
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service AvailableCall Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
 
BEST ✨ Call Girls In Indirapuram Ghaziabad ✔️ 9871031762 ✔️ Escorts Service...
BEST ✨ Call Girls In  Indirapuram Ghaziabad  ✔️ 9871031762 ✔️ Escorts Service...BEST ✨ Call Girls In  Indirapuram Ghaziabad  ✔️ 9871031762 ✔️ Escorts Service...
BEST ✨ Call Girls In Indirapuram Ghaziabad ✔️ 9871031762 ✔️ Escorts Service...
 
A DAY IN THE LIFE OF A SALESMAN / WOMAN
A DAY IN THE LIFE OF A  SALESMAN / WOMANA DAY IN THE LIFE OF A  SALESMAN / WOMAN
A DAY IN THE LIFE OF A SALESMAN / WOMAN
 
Vip Dewas Call Girls #9907093804 Contact Number Escorts Service Dewas
Vip Dewas Call Girls #9907093804 Contact Number Escorts Service DewasVip Dewas Call Girls #9907093804 Contact Number Escorts Service Dewas
Vip Dewas Call Girls #9907093804 Contact Number Escorts Service Dewas
 
Catalogue ONG NƯỚC uPVC - HDPE DE NHAT.pdf
Catalogue ONG NƯỚC uPVC - HDPE DE NHAT.pdfCatalogue ONG NƯỚC uPVC - HDPE DE NHAT.pdf
Catalogue ONG NƯỚC uPVC - HDPE DE NHAT.pdf
 
Monte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSMMonte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSM
 
Monthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptxMonthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptx
 
Socio-economic-Impact-of-business-consumers-suppliers-and.pptx
Socio-economic-Impact-of-business-consumers-suppliers-and.pptxSocio-economic-Impact-of-business-consumers-suppliers-and.pptx
Socio-economic-Impact-of-business-consumers-suppliers-and.pptx
 
M.C Lodges -- Guest House in Jhang.
M.C Lodges --  Guest House in Jhang.M.C Lodges --  Guest House in Jhang.
M.C Lodges -- Guest House in Jhang.
 

01 Struts Intro

  • 1. Jakarta Struts: An MVC Framework Overview, Installation, and Setup. Struts 1.2 Version. Core Servlets & JSP book: www.coreservlets.com More Servlets & JSP book: www.moreservlets.com Servlet/JSP/Struts/JSF Training: courses.coreservlets.com Slides © Marty Hall, http://www.coreservlets.com, books © Sun Microsystems Press For live Struts training, please see JSP/servlet/Struts/JSF training courses at http://courses.coreservlets.com/. Taught by the author of Core Servlets and JSP, More Servlets and JSP, and this tutorial. Available at public venues, or customized versions can be held on-site at your organization. Slides © Marty Hall, http://www.coreservlets.com, books © Sun Microsystems Press
  • 2. Agenda • Understanding Struts – Different views of Struts – Advantages of Struts – Disadvantages of Struts • Setting Up Struts – Downloading and configuring Struts 1.2 – Testing Struts – Setting up Struts applications – Accessing Struts documentation – Adding Struts to an existing Web application 4 Apache Struts: Intro and Setup www.coreservlets.com What is Apache Struts? • An MVC Framework? – Struts provides a unified framework for deploying servlet and JSP applications that use the MVC architecture. • A Collection of Utilities? – Struts provides utility classes to handle many of the most common tasks in Web application development • A Set of JSP Custom Tag Libraries? – Struts provides custom tag libraries for outputting bean properties, generating HTML forms, iterating over various types of data structures, and conditionally outputting HTML. • But which is the proper way to view Struts? – The answer depends on what you are going to use it for, but the MVC framework is the most common way of looking at Struts. 5 Apache Struts: Intro and Setup www.coreservlets.com
  • 3. Advantages of Struts (vs. MVC Using RequestDispatcher) • Centralized file-based configuration – Rather then hard-coding information into Java programs, many Struts values are represented in XML or property files. This loose coupling means that many changes can be made without modifying or recompiling Java code, and that wholesale changes can be made by editing a single file. This approach also lets Java and Web developers focus on their specific tasks (implementing business logic, presenting certain values to clients, etc.) without needing to know about the overall system layout. • Form beans – In JSP, you can use property=quot;*quot; with jsp:setProperty to automatically populate a JavaBean component based on incoming request parameters. Apache Struts extends this capability to Java code and adds in several useful utilities, all of which serve to greatly simplify the processing of request parameters. • Bean tags – Apache Struts provides a set of custom JSP tags (bean:write, in particular) that let you easily output the properties of JavaBeans components. Basically, these are concise and powerful variations of 6 Apache the standard jsp:useBean and jsp:getProperty tags. www.coreservlets.com Struts: Intro and Setup Advantages of Struts (vs. Standard MVC), Continued • HTML tags – Apache Struts provides a set of custom JSP tags to create HTML forms that are associated with JavaBeans components. This bean/form association serves two useful purposes: • It lets you get initial form-field values from Java objects. • It lets you redisplay forms with some or all previously entered values intact. • Form field validation – Apache Struts has builtin capabilities for checking that form values are in the required format. If values are missing or in an improper format, the form can be automatically redisplayed with error messages and with the previously entered values maintained. • This validation can be performed on the server (in Java), or both on the server and on the client (in JavaScript). • Consistent approach – Struts encourages consistent use of MVC throughout your application. 7 Apache Struts: Intro and Setup www.coreservlets.com
  • 4. Disadvantages of Struts (vs. MVC with RequestDispatcher) • Bigger learning curve – To use MVC with the standard RequestDispatcher, you need to be comfortable with the standard JSP and servlet APIs. To use MVC with Struts, you have to be comfortable with the standard JSP and servlet APIs and a large and elaborate framework that is almost equal in size to the core system. This drawback is especially significant with smaller projects, near-term deadlines, and less experienced developers; you could spend as much time learning Struts as building your actual system. • Worse documentation – Compared to the standard servlet and JSP APIs, Struts has fewer online resources, and many first-time users find the online Apache documentation confusing and poorly organized. There are also fewer books on Apache Struts than on standard servlets and JSP. 8 Apache Struts: Intro and Setup www.coreservlets.com Disadvantages of Struts (vs. Standard MVC), Continued • Less transparent – With Struts applications, there is a lot more going on behind the scenes than with normal Java-based Web applications. As a result, Struts applications are: • Harder to understand • Harder to benchmark and optimize • Rigid approach – The flip side of the benefit that Struts encourages a consistent approach to MVC is that Struts makes it difficult (but by no means impossible) to use other approaches. 9 Apache Struts: Intro and Setup www.coreservlets.com
  • 5. Downloading and Configuring Struts • Download the Struts zip file – Start at http://jakarta.apache.org/site/binindex.cgi, or follow the link from http://jakarta.apache.org/struts/. • Unzip into a directory of your choice – For example, unzip into C:jakarta-struts-1.2.4. I'll refer to this location as struts_install_dir. • Update your CLASSPATH – Add struts_install_dir/lib/struts.jar to the CLASSPATH used by your compiler or IDE (not your server). • Install an XML parser – If you have JDK 1.4 or Apache Tomcat, this step is not necessary, since they already come with an XML parser. But, if you use JDK 1.2 or 1.3 with another server, you might need to obtain the XML parsing libraries. Here are two good sources: • http://xml.apache.org/ • http://java.sun.com/xml/ 10 Apache Struts: Intro and Setup www.coreservlets.com Testing Struts • Install struts-blank.war. – Install the Web application from struts_install_dir/webapps/struts-blank.war on your server. For example, with Apache Tomcat, copy struts_install_dir/webapps/struts-blank.war to tomcat_install_dir/webapps/. • Start or restart the server. – Most servers only recognize new Web apps when the server is started. • Access http://localhost/struts-blank/. – This URL assumes you are running the server on your desktop and are using port 80. In general, access http://hostname:port/struts-blank/. 11 Apache Struts: Intro and Setup www.coreservlets.com
  • 6. Testing Struts (Results) 12 Apache Struts: Intro and Setup www.coreservlets.com Setting Up Struts Applications • Option 1 (Good): Copy/rename the struts-blank directory to your development directory. – When you tested your Struts installation, you ran the struts-blank Web app. When you did so, Tomcat and most other servers unpacked the struts-blank.war file into the struts-blank directory. So, copy that directory to whatever location you use for developing custom Web apps, and rename it to whatever app name you choose. – For example, if you are using Tomcat and C:Servlets+JSP is the location you use for development, copy the tomcat_install_dir/webapps/struts-blank directory to C:Servlets+JSP, rename it to struts-test, resulting in C:Servlets+JSPstruts-test. – Note: the index.jsp in struts-blank should be replaced 13 with your own version. Apache Struts: Intro and Setup www.coreservlets.com
  • 7. Setting Up Struts Applications • Option 2 (Good): Unjar struts-blank.war into your development directory. – If your server doesn't automatically unpack WAR files, then even if you ran the struts-blank test described above, you have no regular directory to work with. Besides, some people prefer to unpack the WAR file themselves anyhow. To do so: • Copy struts_install_dir/webapps/struts-blank.war to your development directory. • Make a new directory (e.g., called struts-test). • Unjar struts-blank.war into that directory You can use jar -xvf or a standard zip tool like WinZip or the Windows XP explorer. • Whenever you want to test your application, copy struts-test to the server's Web application autodeploy directory (e.g., onto the shortcut to tomcat_install_dir/webapps). – Again, remember to replace the index.jsp page in struts-blank 14 Apache Struts: Intro and Setup www.coreservlets.com Setting Up Struts Applications • Option 3 (Bad): Rename struts-blank and leave it in the server's deployment directory. – It is quite common to work directly in server's deployment directory (e.g., to work directly in tomcat_install_dir/webapps/struts-test). However, this approach scales poorly to real applications, makes it harder to test changes (you have no stable working version), and doesn't support your quot;realquot; deployment server anyhow (which is almost certainly not your desktop machine). If you don't have a good deployment system using your IDE or ant scripts, you can easily make a shortcut (Windows) or symbolic link (Unix/Linux) to the server's autodeploy directory, and just copy the Web app onto the shortcut each time. For example: • Grab tomcat_install_dir/webapps with your right mouse, drag it into devel_dir, release, and choose quot;Create Shortcut Herequot;. • Create struts-test or other applications as subdirectories within devel_dir, as described above. • Deploy by using the right mouse to drag struts-test onto 15 the shortcut from step 1, releasing, and choosing quot;Copyquot;. Apache Struts: Intro and Setup www.coreservlets.com
  • 8. Accessing Struts Documentation • Read a local copy – This is fastest, but the documentation can get a bit out of date. To read a local copy, install the struts-documentation.war Web app. Copy struts_install_dir/webapps/struts-documentation.war to tomcat_install_dir/webapps, restart server, and use the URL http://localhost/struts-documentation/. • Read it from the Apache site – This option is slower, but guarantees that you get the latest versions of the documentation. Use http://struts.apache.org/learning.html. – The documentation includes FAQs, user guides, tutorials, and the API in Javadoc format. 16 Apache Struts: Intro and Setup www.coreservlets.com Adding Struts to an Existing Web Application • Copy files into your Web app – Copy JAR files from struts-blank/WEB-INF/lib to your_web_app/WEB-INF/lib. – Copy TLD files from struts-blank/WEB-INF to your_web_app/WEB-INF. – Copy struts-config.xml from struts-blank/WEB-INF to your_web_app/WEB-INF. – Copy the application properties file from struts-blank/WEB- INF/classes/resources to your_web_app/WEB- INF/classes/resources. – If you plan on using the automatic validator, copy validation.xml and validator-rules.xml from struts-blank/WEB-INF to your_web_app/WEB-INF. – If you plan on using Tiles, copy struts-tiles.xml from struts- blank/WEB-INF to your_web_app/WEB-INF. • Update web.xml – Copy declarations out of struts-blank/WEB-INF/web.xml into your_web_app/WEB-INF/web.xml. Most importantly, copy the servlet and servlet-mapping entries that map *.do to 17 Apache org.apache.struts.action.ActionServlet. Struts: Intro and Setup www.coreservlets.com
  • 9. Some Struts Sites: Travel 18 Apache Struts: Intro and Setup www.coreservlets.com Some Struts Sites: Government 19 Apache Struts: Intro and Setup www.coreservlets.com
  • 10. Some Struts Sites: Commercial 20 Apache Struts: Intro and Setup www.coreservlets.com Struts is Mainstream: Conservatives and Liberals Use It 21 Apache Struts: Intro and Setup www.coreservlets.com
  • 11. Summary • Struts is an MVC framework – Also a collection of utilities and custom tag libraries • Struts has significant advantages, but adds significant complexity – Compare the use of Struts to the use of normal MVC (especially with the JSP 2.0 expression language) – Also consider other frameworks, especially JavaServer Faces (JSF). • Struts is pretty widely used • Test by deploying struts-blank.war • Develop by copying the struts-blank directory – Don't start from scratch; too many changes needed in your Web app 22 Apache Struts: Intro and Setup www.coreservlets.com Questions? Core Servlets & JSP book: www.coreservlets.com More Servlets & JSP book: www.moreservlets.com Servlet, JSP, Struts, JSF, and Java Training Courses: courses.coreservlets.com Slides © Marty Hall, http://www.coreservlets.com, books © Sun Microsystems Press