Java Struts2 Outline
Java Struts2 Outline
Course Overview
It is expected that the course will change in response to delegates experience, progress with the practical examples and
professional needs.
Tools used will include Java 5, Apache Tomcat and the Eclipse IDE. All of these tools are embedded in the WebSphere
Application Developer tool (WSAD)
These areas would be suitable for a follow up / refresher course within approx 12 weeks.
Facilities provided
•CD / Website with the above tools
•Knowledge base (Web based Wiki) providing notes and samples gathered during the 2 days.
•Internet Enabled PC's with supporting training facilities.
Tomcat 5.5 :
http://apache.mirrors.esat.net/tomcat/tomcat-5/v5.5.20/bin/apache-tomcat-5.5.20.zip
Unzip or install in C:\Software\Tomcat_5_5\
Eclipse 3.2:
http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops/R-3.2.1-200609210945/eclipse-SDK-3.2.1-
win32.zip
Unzip or install in C:\Software\Eclipse\
Struts 2 (Beta):
http://apache.oss-mirror.org/struts/binaries/struts-2.0.1-all.zip
Leave on Desktop – we install as part of course
•Housekeeping
General IACT
Timings
•Demo
Selected slides on Java Syntax (Java Nuts and Bolts – slides 14-116)
■Variables, Loops , Conditional , Arrays and output
•Demo
•Practical
•Slides
● Method visibility
● Parameters
● Operator Overloading
● Return Types
•Practical
1.JavaBean – write a javabean to hold the following values: Name , Address , Telephone number
2.Put JavaBean into collection
3.Loop and print them out
4.Add a message when the constructor is called
5.Add a variable to the JavaBean at class level and make it static. Create two instances of the same java bean. Show that a
change to the static value on one javabean changes the static value on the other.
•Demo
• Refactor
• Optional – Oop2
• Optional - Strings
•Demo
•Practical
•Slides
What is MVC
Picture of Excel Spreadsheet & Chart as Example
•Practical
Refactor the number guess example from yesterday to use an MVC Pattern. Should have three classes.
Model – A Java bean , with no other code
Controller , all the program logic , but no other code
View – a simple command line interface, does as little as possible.
(Optional) write a Junit test for this to replace the View
(Optional) write a toString() method for the JavaBean to print its contents. Log the JavaBean and see what happens.
•Demo
• What is a webserver
• What is Tomcat
•Demo
• Setting up Tomcat
• Download
• Unzip
• Run
•Setup Eclipse Project
• Do Simple 'Hello World' JSP.
•Practical - Editing Tomcat Projects in Eclipse
Setup Tomcat
Setup Eclipse Project
Create a new JSP. Write out the values 'Hello World / Goodbye World' as in the previous sample
•Demo
Downloading Struts
Setup Eclipse Project to allow editing
Tour of the Blank Web application
• Index.html _> Response Cycle
•WEB-INF
•web.xml
•applicationContext.xml
•lib
• classes
•src / java
•META-INF
sample application
How Resuse
Simple changes
Change of property file
Display 2nd tag on screen
Write value in controller , display on screen (hello world)
•Practical 2
Convert our Hello World / Goodbye world to use Struts.
● Most simple form, ok to output loop as one piece of text
•Demo
•Practical
•Demo
•Practical
•Slide
•Practical
•Demo