Open Source Web Programming
The open source Web programming SIG focuses on application programming centered around open source tools for Windows and Linux including PHP, MySQL, Apache, Web Matrix, sourceforge.net projects & anything else FREE, easy and cool an application developer can use. You could also call it call it WLAMP application development.
Contact: John
Lansdale, 914-533-2002. Meets on the 3rd Monday, 7:00
p.m. at the DACS Resource Center.
Yahoo! Group: PHP_DACS
News and Notes
Richard Corzo was back this month with another Java lesson. Six of us sat around the table and with his patient help successfully turned our laptops into powerful Java / Eclipse (the newest) / Apache Tomcat development machines As you’ve learned by now, setup’s the hard part. All we need to do now is add the powerful code -- piece of cake for us professional developers.
True to our charter all software was free and we did this on a mix of computers, Windows XP, Suse Linux, Windows 2003 Server, none were really high performance. Disk space for the whole thing was about 300 meg (147 meg for Eclipse, the JDK about 130,and 9 meg for Tomcat).
The web site we used as a guide was IBM’s Developing Web applications with Tomcat and Eclipse. Eclipse is a very complete code editing tool and development environment. It comes from IBM. Tomcat is a web server configured for running Java web applications. It comes from the Open Source Apache. Java, is the programming language and runtime system from Sun Microsystems. *
Table 1. Components and versions used
----------------------------------------
Eclipse Platform 3.2.2
Java EE 5 SDK 1.5.0_09
Apache Tomcat 5.5.20
We installed the eclipse classic. You just download and unpack it somewhere (i.e. ProgramFiles\Eclipse or /home/eclipse32.) It runs as is, no setup, even delete the folder when you’re done. Next, we installed the web tools in Eclipse. (Help > Software Updates > Find and Install) **
Then we downloaded (a couple of us downloaded, others used the copy Richard had on a thumb drive or a network connection) and installed the Apache Tomcat 5.5.
Back in Eclipse, we took File > New Project > Dynamic Web project. We named ours ExampleProject. Next was creating a target runtime. This is the web server which will be used for running our Java server page code. When prompted we pointed it to the Tomcat 5.5. Then you’ve got to add the server to the project (seems redundant to me, if Eclipse knew we wanted to use Tomcat 5.5 why not just set it up automatically). It’s easy enough though. Just take New > Server and choose Tomcat 5.5. Point the server to the project.
For test code we just cut and pasted in the IBM example (below). In eclipse it was File > New > Other . Web > jsp, name index.jsp, paste the copied code.
They tell you to publish the page by right clicking on the server > Publish. Then browse to localhost:8080/ExampleProject to see the results. As a compulsive non-conformist I had to do if differently I started the server on one of the tabs in the bottom/center and browsed to the page. This worked too but I had stopped reading instructions and browsed to the wrong address (http://localhost/ExampleProject instead of the correct http://localhost:8080/ExampleProject, I left out the port number).
Listing 1:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>My Title</title>
</head>
<body>
<% java.util.Date d = new java.util.Date(); %>
<h1>
Today's date is <%= d.toString() %> and this jsp page worked!
</h1>
</body>
</html>
The result :
Today's date is Wed Sep 17 21:00:36 EDT 2007 and this jsp page worked!
We could have added:
Another fast two hours has passed, time to go home. Until next month when Richard promises to be back.
If you need/want to learn Java, come join us next month. You can start in any time, we’ll help you get caught up. Your DACS membership is valuable. Just one of these sessions would cost you hundreds of dollars if you paid for training or hired a professional to teach you, and that wouldn’t be as nearly as effective.
John Lansdale, CDP, MCP
* In Microsoft terms Eclipse is Developers Studio, Tomcat is Internet Information Server and Java is C#, VB.NET or one of the other Asp.Net languages. With LAMP it’s the Zend Developers Environment, Apache (with the PHP module) and PHP.
** This find/install/update from inside Eclipse is very convenient. As well as keeping up to the newest releases, I’ve found and installed Eclipse tools for XML editing, UML design, writing PHP and Ruby code. |