
Understand the Architecture and History of the Apache Struts 2 Framework
Setting up our Development Environment with JDK 8, Eclipse, Tomcat and MariaDB
Getting started with Struts 2 core components with code examples
An overview of the Struts 2 Framework Architecture, Design, and history.
An overview of our development environment for Struts 2:
Windows 10
JAVA 8 JDK
Tomcat 8.5.x
Eclipse
Maria DB
with external links to the official installation and setup documentation attached.
A walkthrough of downloading and installing the Oracle Java Development Kit 8 on Windows 10
A walkthrough of downloading and installing the Eclipse IDE for Enterprise Java Developers in Windows 10. An external link to the Eclipse command line runtime options is attached in the resources section.
A walkthrough of downloading, installing and configuring Tomcat 8.5.x in Windows 10
An overview of setting up Tomcat within the Eclipse IDE in order to run and debug Java Web Applications.
An overview of downloading, installing and running the Maria DB in Windows 10, using the Administrator Command Prompt.
Resource links:
https://downloads.mariadb.org/mariadb/10.4.7/
https://mariadb.com/kb/en/installing-mariadb-windows-zip-packages/
https://mariadb.com/kb/en/mysql_install_dbexe/
An overview of setting up a JDBC Connection Profile to the Maria DB and accessing the database from within the Eclipse Data Source Explorer
Creating a basic Struts 2 Web Application program with the help of Eclipse.
Create a new Dynamic Web Project (Generate web.xml)
Set Apache Tomcat as the target runtime
Set Web App Context Root in Eclipse
Download and install Struts 2 libraries in WEB-INF/lib
Add index.jsp
Add a struts.xml configuration file
Re-use our struts2-basic template created with Eclipse in the previous lesson
Create a server page input form to accept “Your Name” (View)
Create an Action class to control the interaction (Controller)
Create a server page to display custom Hello “Your Name”
Create a mapping in struts.xml to couple action and view (Declarative Architecture)
URL Tag
Form Tag
Property Tag
Mapping an Action to a class
Mapping a result to a view
Writing controller logic in the Action class
Re-use our hello-world project
Create a the Insurance Agent Model Object
Create the Insurance Agent Enrollment Form
Create a new Action Class that will enroll the Insurance Agent
Create new Response JSP
Create a mapping in struts.xml to couple action and view
Re-use our form-processing project
Add a validate method to our Insurance Agent Register Action
Write code to validate Insurance Agent fields
Expand struts.xml to handle input validation errors
Write the code to display the validation errors in our Register.jsp
Re-use our form-validation project
Create a message resource file for our Register Action
Use the key-value pairs in our message resource file in register JSPs and Action
Expand the property files so we can use them in packages
Write a Spanish Language resource file for registering our Spanish speaking agents
Re-use our i8n resource file project
How to specify and handle Global Exceptions
How to specify and handle an exception for a specific Action
How to log exceptions in a log file
How to display an Exception in the browser
Re-use our Exception Handling project
Debug a Struts 2 Application using the Eclipse IDE
Use the Struts 2 Configuration Browser Plugin
Use the Struts 2 debugging Interceptor
Use logging
Re-use our exception handling project
Look at the Interceptor Layer for our Register Action
Add specific Struts 2 Interceptors to our Register Action
Run our Struts 2 Interceptors for the Register Action
Discuss writing our Interceptors
Re-use our Struts 2 Spring project
Expand in-memory service store class (ads states to the database)
Implement the Preparable Interface in our Register Action (get states)
The implemented Prepare method will always be called by the Prepare Interceptor (also on validation fails)
Update our Register Input form with State Drop Down tags
Run our Register Action to show how the State Drop Down tag is used.
Re-use our interceptors project
Review the SessionAware Interface
Add the SessionAware Interface to our Register Action
Store the Registered Insurance Agent Data in the Session
Display the Insurance Agent Data stored in the session
Re-use our http-session project
Create an in-memory service store class (database)
Add the Spring Configuration to web.xml
Add the service store class to the spring configuration file applicationContext.xml
Use the Maven Repository to figure out transitive dependencies to add to LIB
Run our Spring App to demo in-memory store
Create the application using the Maven WAR Archetype
Change the generated Archetype WAR Application to a Struts 2 Web App
Write the Login Action and Interceptors
Set up and populate our Maria DB
List Insurance Agents with Spring JDBC Template
Create Insurance Agents with Spring JDBC Template
Update Insurance Agents with Spring JDBC Template
Delete Insurance Agents with Spring JDBC Template
Create Insurance Admin Application from Maven WAR Archetype
Set up Eclipse Repository for the latest Maven WAR
Update web.xml to 3.1
Run the Maven Archetype Generated web application
Re-use our i8n resource file project
How to specify and handle Global Exceptions
How to specify and handle an exception for a specific Action
How to log exceptions in a log file
How to display an Exception in the browser
Create Insurance DB using MariaDB Command Line
Stop Old DB, Start new DB with MariaDB Command Line
Re-use our refactored Maven Archetype Project (struts2-insurance-admin-crud2)
Set up Eclipse DB Connection
Populate Insurance DB inside Eclipse with SQL Scripts
Re-use our previous project (struts2-insurance-admin-crud3)
Add the Administrator Class (POJO Bean)
Add the Administrator Service to authenticate Administrators (In Memory DB)
Expand Login Action to use Administrator Service Authentication
Use Struts Validation in login.jsp
Change Login Action to store valid logged in Administrator in a Session Object
Add a global Interceptor that will check for a valid Administrator in the Session
Re-use our created project (struts2-insurance-admin-crud4)
Create Insurance Agent Model Object (match MariaDB table)
Create Insurance Service Interface (Get All Insurance Agents)
Add spring configuration (web.xml, pom.xml, Spring Config class)
Implement the Insurance Service using Spring JDBC Template
Test the implementation with a Main method test driver
Add the Insurance Action and Display List JSP
Re-use our created project (struts2-insurance-admin-crud5)
Update our MariaDB Tables with Auto Increment PK Keys
Add State Model Object and expand Service to get the States
Alter Insurance Agent Model Object to include State Object
Test creating Agent and getAgent() method with Main Driver
Re-use our created project (struts2-insurance-admin-crud6)
Create a JSP form to show an Insurance Agent with State Drop Down
Add Insurance Action method to populate the form (show)
Test JSP and action in Tomcat Service with Eclipse
Re-use our created project (struts2-insurance-admin-crud8)
Update Agents List Form with an Insert Action Link
Fix our Active and Expensed bugs from previous lecture
Expand the Insurance Action method to save to be able to a DB Insert
Test JSP and action in Tomcat Service with Eclipse
Re-use our created project (struts2-insurance-admin-crud9)
Update Agents List Form with a Delete Action Link
Fix any Spring JDBCTemplate bugs identified previously (Insert Agent)
Expand the Insurance Action class with a delete method (JDBCTemplate Delete Method, Main method test driver)
Test JSP and Struts 2 Action in Tomcat Service with Eclipse
Understand the Architecture and History of the Apache Struts 2 Framework
Setting up our Development Environment with JDK 8, Eclipse, Tomcat and MariaDB
Getting started with Struts 2 core components with code examples
Build a working Struts 2 ”CRUD” Application with JSP, Struts 2 Actions, the Spring JDBC Template and MariaDB
In the first module we will review and understand the Architecture and History of the Apache Struts 2 Framework. We will look at the progression from Struts 1 to Struts 2 and the security bug that caused major concern with Struts 2 Users Worldwide.
In the second module we will set up our development environment on a Windows 10 machine. First we will download and set up JDK 8. Then we will download and install the latest version of the Eclipse IDE. We will download and install the MariaDB and integrate this database with our Eclipse IDE. We will also download and install the Tomcat Web Server and Integrate it with our Eclipse IDE
In the third module we will work through a number of code examples that demonstrates the core concepts and capabilities of the Spring 2 Framework.
We will start with the custom "Hello World" Application
We will review Struts 2 Tags and Actions.
We will look at processing input forms and form validations.
We will look at internationalization and the related custom resource bundles
This course is intended for Java Developers who needs to maintain or extend a legacy Apache Jakarta Struts 2 system running in production.