J2EE Course: Java Web Services with SOAP and Axis

This free online course will teach you how to create Java web services using SOAP and Axis. Web services are an extremely popular communication mechanism between remote systems, and a very marketable skill to have on one's resume.

Axis is open source framework for building Java web services using SOAP, which is a standard protocol for XML-based web services that allows Java-based systems to communicate remotely with other systems running other languages such as Microsoft C#.

Course Prep:

  1. View the Java Web Services lecture in Powerpoint format (also available here in pdf format), which will provide an overview of Java Web Services and several useful code samples.
  2. Install Tomcat 5.0.28 or later (follow the instructions for creating a Tomcat web application).
  3. Download Axis 1.4 from our friends at Apache. Inside the zip file you'll find an axis-1_4\webapps\axis folder. Install Axis by expanding the axis folder into your Tomcat webapps folder. If done correctly, you should see a webapps\axis folder on your system.

Course Exercises:

For this course, you will build a SOAP web service that provides an account balance to requesting applications in the form of a SOAP message. You will also build a client application that creates and sends a SOAP message requesting this account balance.

Verify Your Axis Installation

Java Course: JDBC MySQL Database Connectivity

This free online course will teach you how to interact with a MySQL database programmatically using Java. Almost without exception, every application you build in the real world will store critical information in a database, and knowing how to use Java database connectivity (JDBC) to communicate with a database will be an excellent skill to have on your resume.

If you haven't worked with databases or SQL before, then please first complete the Database Course: MySQL and SQL CRUD Operations before taking this course.

Course Prep:

  1. Read Chapter #14 in the Core Servlets and JavaServer Pages textbook (pages 591 - 606, and pages 616 - 622).
  2. View the JDBC lecture in Powerpoint format (also available here in pdf format), which will provide an overview of JDBC and several useful code samples.
  3. Download and install MySQL Server 5.0 by following the instructions in MySQL5_Install_Configure.doc.

Course Exercises:

  1. Follow course exercises 1 through 4 in the Database Course: MySQL and SQL CRUD Operations to load a pre-built SQL script. This will create an Etraining database containing two tables: users and accounts.
  2. Create the following Java business objects and data access object, and implement the methods defined below:
    • Login (business logic specific to user information)

Eclipse Tips and Tricks

Eclipse is a very powerful IDE with a vast array of features, and it seems like I'm always stumbling on new ones. Here's a list of the Eclipse shortcuts I use the most often:

  • Find any resource or type - Ctl + Alt + R will display a Search for Resource dialog - just start typing the name of the resource, and Eclipse will display a list of matching resources (handy for finding xml deployment descriptors when you're not sure where they're located). Ctl + Alt + T does the same thing, but is specific to Java types.
  • Move a line of code up and down - Alt + UpArrow moves a line of code up. Alt + DownArrow moves it down. It will not overwrite existing lines of code above or below the current line, and you don't have to have the entire line selected. This also retains the code comment formatting/spacing, which is not retained when you manually cut and paste a code comment (thanks Juanita!)
  • Copy a line(s) of code above or below - Ctl + Alt + UpArrow copies the currently selected line(s) above the current selection. Ctl + Alt + DownArrow copies the currently selected line(s) below the current selection.
  • View all classes that implement an interface - select the interface and press Ctl + T to view a list of all classes that implement or extend the selected interface. Very handy when using frameworks like Spring or Tapestry that use interfaces instead of concrete classes.
  • View all references to the selected construct - Ctl + G will display all references to the selected class, interface, method, or variable. Ctl + g will display all occurences of the selected construct. Very useful for finding all the places that a method or variable is being used.
  • Drill down into a method or variable declaration - Click anywhere in the method or variable name, and press F3 to navigate to its definition. Press Alt + Left Arrow to navigate back.
  • Organize import statements and remove unused imports - Press Ctl + Shift + O (works recursively if you select a project or folder).

Database Course: MySQL and SQL CRUD Operations

This free online course will teach you how to install the MySQL database and perform standard CRUD (Create, Read, Update, and Delete) operations to manipulate the data in the database. You'll learn how to execute a SQL query, which is a way of asking the database to give us the specific data we're looking for, and how to modify existing data using a SQL statement.

Most business applications store critical information in a database, and having database experience is an important skill to have on your resume in today's IT world.

Course Prep:

  1. Read Chapter #14 (pages 591 - 605) in the Core Servlets and JavaServer Pages textbook.

    The reading in chapter 14 does a good job of covering general SQL CRUD statements, and the statements work the same regardless of which database is used (in fact, the book uses the Hypersonic database, but we'll stick with MySQL which is much more widely used in the real world).

  2. Download and install MySQL Server 5.0 by following the instructions in MySQL5_Install_Configure.doc.
  3. View the MySQL lecture (also available in pdf format here), which provides an overview of database concepts and an introduction to SQL CRUD operations.

Course Exercises:

  1. Open a MySQL command window and enter the SQL commands from the lecture. You'll find the MySQL command window by running mysql.exe, located in the bin folder of your MySQL installation.

J2EE Course: XML and XSLT Programming With JAXP

This free online course will teach you how to use Java to programmatically work with XML in a web application. Please complete the XML and XSLT Overview Course before taking this course, which will provide you with an introduction to XML and XSLT.

Course Prep:

  1. Read chapter 2 in the J2EE and XML Development textbook from Manning Publishing Co (free chapter).
  2. View the Java XML and XSLT lecture (also available in pdf format here).

The exercises in this course build on the web application created in the J2EE Course - Building Servlet Web Applications course. Please complete that course first before starting the XML and XSLT Programming With JAXP course.

Course Exercises:

  1. Open the Eclipse Tomcat project created in the J2EE Course - Building Servlet Web Applications course and add a Java class called AccountBean.java. Create a getAccountInfo(String User, String Password) method that builds an XML String in the format shown below.

    Note: Use JAXP methods such as createElement and appendChild - do not use String concatenation (there's nothing wrong with String concatenation, but you won't learn to use JAXP if you rely on String concatenation). Replace the user and password values with the values the user enters from the login.html page.

    <?xml version="1.0" encoding="UTF-8"?>

Programming Course: XML and XSLT Overview

This free online course will give you a fundamental understanding of XML and XSLT, and will teach you how to create XML documents and convert them to HTML using XSLT transformations.

Course Prep:

  1. Read chapter 2, pages 38 - 56, in the J2EE and XML Development textbook from Manning Publishing Co (free chapter).
  2. View the XML and XSLT Overview lecture (also available in pdf format here).

Course Overview:

You'll often encounter systems that need to communicate with each other across the Internet using different operating systems, different computer languages, and different web servers.

XML makes a great neutral communication mechanism because it's just plain old ASCII text that's formatted in a certain format. Any computer language that can read and write text files can work with XML.

There are also times when a hierarchical set of data is requested from a database, and transmitted between systems. XML provides a way to describe hierarchical data in a much more robust manner than comma-delimited formats.

XML describes data but does not normally contain instructions for how the data should be displayed. The display instructions are usually handled by HTML, and XSLT provides a way to convert XML into HTML.

You'll notice that an XSLT document is itself an XML document that provides instructions to an XSLT processor about how to format the resulting HTML. The XSLT processor handles embedding XML data in HTML commands so that a web browser can properly display the data in the desired format.

J2EE Course - JavaServer Pages and the Model 2 Design Pattern

This free online course will teach you how to create a JSP page, and how to use the Model 2 Design pattern to build extensibility and scalability into your J2EE web applications.

Course Prep:

  1. Read Chapter 3 in the Core Servlets and JavaServer Pages textbook.
  2. View the JavaServer Pages Powerpoint slides (also available in pdf format here).

If you have not worked with servlets before, then I highly recommend that you start there first. JSP pages are compiled into servlets by the web server, so it's very important to understand how servlets work under the hood before trying to work with JSP pages.

Course Overview:

You'll first convert the servlet from the J2EE Course - Building Servlet Web Applications to a JSP page with the same functionality. The resulting JSP page will be small compared to the servlet code, and you should start to see how easy it is to create JSP pages with a line or two of Java inserted between the HTML tags.

J2EE Course - Building Servlet Web Applications

This free online course will teach you how to build dynamic web applications using Java Servlets. You'll learn how to handle HTTP requests from a browser and return HTTP responses with dynamically generated HTML. You'll also learn about sessions, cookies, and how to package and deploy a servlet-based web application to a Tomcat web server.

Course Prep:

  1. Read chapter 2 in the Core Servlets and JavaServer Pages textbook.
  2. View the Java Servlets Powerpoint lecture (also available in pdf format here).

Course Exercises:

  1. Download and install the Sysdeo plugin in Eclipse, and create a new Tomcat project called assign03. Review the "Creating a Tomcat Web Application" course for assistance with this step.

  2. Download a pre-built HTML account login form that posts to a login servlet: login.html (NOTE: right-click on the link and select "Save Target As"). Place login.html in the root folder of your Tomcat project (the same location as index.html from the Creating a Tomcat Web Application course).

  3. Configure your web application so that login.html is the default welcome page.

J2EE Course - Creating a Tomcat Web Application

This free online course will cover installCation and configuration of Tomcat, and creation of a basic J2EE web application. You'll learn how to configure a default HTML welcome page by understanding the web.xml deployment descriptor, and will learn how to set the web server port number by understanding the server.xml deployment descriptor.

Course Prep:

  1. Read Chapter 1 in the Core Servlets and JavaServer Pages textbook.

  2. View the J2EE_Web_Applications Powerpoint lecture (also available in pdf format here).
  3. Install Java.

    Tomcat requires a Java J2SE SDK (standard edition software development kit, also referred to as a JDK) to be installed on your system.  It will not work with only a JRE (Java runtime edition) so be sure to install the Java 1.4.2 or greater SDK before installing Tomcat. Here's a link to download the Java J2SE SDK 1.4.2.

Course Exercises:

Java Course - Creating a Java Application with Eclipse

This free online course will walk you through creating a Java project in Eclipse, including compiling, packaging into a jar file, and running the application from the command line. It assumes you have already installed Eclipse on your system and have completed the Eclipse Tutorial - Installing and Running Eclipse.

Creating a Java Project

A Java project in Eclipse will contain all of the .java class files that our application needs, along with any .jar file libraries that our application might depend on.

Start Eclipse and select File - New - Project from the main menu. You'll see the New Project wizard where you'll select Java Project. We'll choose the name assign01, since this is the lesson exercise I give students on the first week of class.

Click "Finish" to accept the remaining default settings for a new Java project.

Creating a Java class

We'll create a math utility application that calculates the average value of a set of numeric values. Nothing complex, but enough to gain a good understanding of how to use Eclipse to create and package a Java application.

Select File - New - Class from the main menu. You'll see a New Java Class wizard which will ask for the name and location of the new source code file. Enter MathUtil as the file name and cis as the package (short for Computer Information Systems). NOTE: Be sure to check the option to create a public static void main method, since this will be the entry point to our application when we run it from the command line.

Syndicate content