I used the following material to give a one-hour overview of Java and web applications to a group of developers experienced in the Microsoft ecosystem.
See the following sections of this useful Introduction to Java Programming:
Section 13 provides an overview of JAR (Java ARchive) files. More details at the Java Tutorial Lesson: Packaging Programs in JAR Files.
The standard Java library has two classes for dates and times: java.util.Date and java.util.Calendar. Both are mutable and difficult to use for common date arithmetic. A much better replacement is Joda-Time. In particular, the LocalDate class is an “immutable datetime class representing a date without a time zone”. Most of the time, this is exactly what you need.
Java does not have a built-in decimal data type. Instead, you need to use the BigDecimal class in the standard library for immutable, arbitrary-precision signed decimal numbers with complete control over rounding behavior.
Do not use either of the binary floating-point types (float or double). It is impossible to represent 0.1 (or any other negative power of ten) as a float or double exactly. The representation errors and rounding errors will bite you. See http://floating-point-gui.de/ for more details on “what every programmer should know about floating-point arithmetic (or why don’t my numbers add up?)”.
I recommend carrying the currency with every monetary value, as documented in the Money pattern (Patterns of Enterprise Application Architecture, Martin Fowler). The Currency class in the standard Java library represents currencies using their ISO 4217 currency codes.
The book Effective Java, Second Edition by Joshua Bloch gives much useful programming guidance in bite-sized articles.
The most basic component of a Java web application is the servlet: a Java class that responds to HTTP requests.
After that, you’ll find the other 32 chapters describe many other technology components that you can add to Java web applications, including Web services.
The following pages give detailed instructions on how to build a Hello World web application. Along the way, they introduce the Eclipse IDE, the Ant build tool, and the Tomcat servlet container.
The copyright notice on these pages is rather amusing.
A public-facing web application has particular security issues. See the Open Web Application Security Project (OWASP) Top Ten for a general overview, and then see the Enterprise Security API for Java EE, which provides a security framework for Java web applications.
You can email me at geeks#stephen.viles.geek.nz (change # to @).
Copyright © Stephen Viles. You can share or adapt this material under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 New Zealand license. This site is built with nanoc and hosted by NearlyFreeSpeech.NET.