• Embed Doc
  • Readcast
  • Collections
  • CommentGo Back
Download
 
The Power of Three - Eclipse, Tomcat, andStruts
Introduction
As a programmer it's important to be productive, and as any other craftsman you need good tools to be productive. In this article I'll present a set of tools, which can really help you get your job done.What's more, they're all free, open source, and well documented. I've been using these tools inseveral real-life projects and have found that they often outdo expensive development tools. This is because they're simple to install, simple to use, reliable and have good performance.The names of the tools are Eclipse, Tomcat, and Struts.You've probably heard about all of them, and maybe you have used them in your work, but anyway:here's a short description of each:
Eclipse is an IDE from eclipse.org, which can be used for programming in Java and manyother programming languages.
Tomcat is a J2EE web server from the Apache Jakarta project
Struts is a framework--also from Apache Jakarta--for building MVC-type servletapplicationsSo, these tools are made for making web applications based on the servlet specification. They don'tcover EJB's, since Tomcat is not an EJB-server, and standard Eclipse does not cover EJB's.Eclipse has a project type for Java development, but strangely enough not for Java web applicationdevelopment. A Java web application is characterized by a special directory structure (war-filestructure), and a set of specialized files: jsp-files, XML configuration files, servlets, etc. To fill thisgap, a very nice Eclipse plug-in from sysdeo.com is at hand. It not only gives us the webapplication project but also a way of managing the Tomcat server from within Eclipse. Below we'llsee how to install and use this plug-in.Struts gives you a way of building modular, de-coupled web applications. How Struts is included inEclipse is another topic that'll be covered later in this article. 
Install Eclipse
The first thing to do is to install Eclipse. I've chosen to use version 3.0M4 even if a newer version,3.0M6, exists. This is because the Sysdeo plug-in explicitly states that it supports 3.0M4. Bewarned: Eclipse is a rather large download: 69.1 Mb! You either need a speedy connection or a lotof patience.Installation however, is a breeze. Unzip the downloaded file, locate the
eclipse.exe
in the downloadfolder, double- click and you're off.If you're not familiar with Eclipse, then use the built in documentation to get started. Select "Help"in the menu bar, and then "Help Contents".
 
Install Tomcat
The next step is to install a version of Tomcat. I've chosen the latest release, which currently is5.0.16. Installation is as simple as Eclipse. You download a zip file and unzip it in a folder. OnWindows you start Tomcat by opening a DOS window, and then run the
 startup
bat-file from the bin directory. The environment variable
 JAVA_HOME 
must be set to the folder of your JDK, or thestartup file will fail. I usually insert a line in the beginning of the
 startup
file, and also the
 shutdown
file, for example:
set JAVA_HOME=c:\j2sdk1.4.1_01
In order to be able to run the "admin" and "manager" programs in Tomcat you must define a user for this. Locate the
tomcat-users.xml 
file in the
conf 
folder, and insert this line:
<user username="admin" password="admin" roles="admin,manager"/>
Before proceeding you may want to start Tomcat to see if everything works. Run the
 startup
bat-file from a DOS- window. This will bring up another DOS-window for Tomcat, and when it hascompleted initialization you'll see:
28-12-2003 13:10:40 org.apache.catalina.startup.Catalina startINFO: Server startup in 17005 ms
In a browser you may now enter 
which will show the Tomcat welcome page: 
Install the Sysdeo Tomcat plug-in
Before installing the Tomcat plug-in you should stop Eclipse and Tomcat if they're already running.
 
There are a couple of Eclipse/Tomcat plug-ins available on the market. The most well-known, andthe one we'll be using in this article, is the Sysdeo plug-in. The plug-in is available for several versions of Tomcat and Eclipse, and it's important to pick the one that matches your versions. For Eclipse 3.0M4 and Tomcat 5.0.16 you should use plug-in version 2.2.1. A complete list of allversions can be seen at this address: http://www.sysdeo.com/eclipse/tomcatPlugin.html. A release note file is available at http://www.sysdeo.com/eclipse/releaseNotesV221.txt,and you may find it useful to have a look at it, since it gives a feeling for the maturity and level of ambition for thesysdeo plug-in project.The installation of the plug-in does not differ from other Eclipse plug-ins: After downloading the plug-in unzip it to Eclipse's "plug-ins" directory, and start Eclipse. It's possible to customize the useof the plug-in in various ways, which we'll see in the following. First of all you may verify that the plug-in has been installed by selecting Help/About/Plug-in Details from the menu (see the line atthe bottom of this picture):
Customize the Sysdeo plug-in
You should now tell the plug-in where your Tomcat system is located. From the menu selectWindows/Preferences/Tomcat and select
Tomcat version number 
Tomcat home (this automatically sets the configuration file)
of 00

Leave a Comment

You must be to leave a comment.
Submit
Characters: ...
You must be to leave a comment.
Submit
Characters: ...