Date Created: Tue 27-Nov-2007

Related Document Categories:



    Eclipse doesn't come with a template that allows you to create Web projects. you have to create them yourself. I have a solution ...

    There is a little gem from SYDEO
    http://www.sysdeo.com/eclipse/tomcatplugin which allow you to create Tomcat web projects (saves you time setting up your own web based project).

    In this article I am using Eclipse 3.2 in a Windows XP environment downloaded from eclipse.org. The Tomcat version is 5.5.20 downloaded from Apache.org. I have also installed the Tomcat Administration Application go to
    http://www.webspheretools.com/sites/webspheretools.nsf/docs/Tomcat%20Administration%20Application to see where to get Tomcat 5.5.x Administration Application

    Installation of Sydeo plug-in into Eclipse 3.2

    1. Download appropriate plug-in version from
    http://www.sysdeo.com/eclipse/tomcatplugin. I downloaded Beta2.

    2. Unzip the download in the Eclipse plug-ins folder <eclipseroot>\plugins e.g c:\eclipse\plugins

    3. Run Eclipse. You can see the Tomcat menu option added to the Eclipse menus.



    4. You can also adjust the toolbar by changing the perspective if you wish e.g




    This means that when you use the New option to create a New Project a Tomcat Project will be available to help you build a Web project which is based on the WAR structure.

    What is a WAR structure? Click
    http://www.scrobinson.info/Steven_Charles_Robinson.nsf/0/D49BC5E56066D3C6802572230068FB49!opendocument to go to a small article about WAR files.



    5. Before you can use the Tomcat administration options ie Start, Stop & Restart from the Tomcat menu, you must configure the plug-in using Windows-Preferences.





    I personally us Windows Services to start and stop tomcat and use the Apache Tomcat tray tool. Using the plug-in means that a different instance of Tomcat is being started and stopped and is not the same as the Tomcat instance managed by the Windows service controller. You can use the Windows-Perspective menu option to disable this toolbar if you do not wish to use the Tomcat menu item.

    6. Create a new Tomcat project





    The resulting Web configured project is created. The web structure below support the WAR format.



    Here is my on disk structure for the new project.



    Files in your project should be placed in these folders:

    WEB-INF/lib

    html- and jsp-files <projectname>

    Java source files WEB-INF/src

    Java class files WEB-INF/classes

    Jar-files


    Note the WEB-INF/src need not actually be here, but WEB-INF must since this is the J2EE standard. The reason for the
    work folder also being set as a source folder is that Tomcat places the servlet code generated from jsp-pages here.

    Tomcat uses the server.xml file from the conf directory for various purposes. One of them is to locate projects that are not placed in Tomcat's webapps folder (the default webapps folder). A typical example fo this is

    <Context path="/<projectname>"
    reloadable="true"
    docBase="C:\eclipse3.2\workspace\<projectname>"
    workDir="C:\eclipse3.2\workspace\<project>\work" />


    In menu option Windows-Preferences-Tomcat as shown previously, you can also set the plugin from Sydeo to modify this automatically, however I do not do this myself.



    Another thing to notres is you will also see that the Project-Properties-Java build path has entries ready for this project.




Middleware Mentor - Steven Charles Robinson

About Me

Steve Robinson has been working in IT for over 15 years and has provided solutions for many large-enterprise corporate companies across the world. Steve specialises in Java and Middleware consulting. Steve comes from both an administration and development background.

Before moving to JEE, Steve was an accomplished developer and consultant for both IBM Lotus Notes and Microsoft .NET Technologies.

Follow Steve as @stevencrobinson on twitter.

Read my books?

IBM WebSphere Application Server 8.0 Administration Guide

IBM WebSphere Application Server 8.0 Administration Guide

WebSphere Application Server 7.0 Administration Guide

WebSphere Application Server 7.0 Administration Guide

WebSphere Categories

Oracle WebLogic Categories

JBoss Categories

Other Categories