Skip to main content

Programming: Java Servlet Development for Apache Tomcat with Eclipse

I was starting a not-so-small Tomcat servlet development project -- to modify and extend the Blojsom blogging server for my thesis work. I was suggested that Borland JBuilder is a better tool for servlet development. I liked JBuilder when I hadn't known Eclipse. But now that I'm so used to using Eclipse, I don't want to go back.

I was misled that I need a "Tomcat plug-in" for Eclipse to develop servlets. Spent 5-6 hours trying to get the seems-popular Sysdeo Eclipse Tomcat Launcher plugin V3.2 Beta 2 to work the way JBuiilder servlet development tool worked for me. It just didn't work the way I like.

Finally I found a discussion thread on an Eclipse site that refers to the WTP Tutorials – Building and Running a Web Application article by Naci Dai which showed me how to make Eclipse work the way I like:

According to Dai, all I have to do are:

1. Get the Eclipse Web Tools Platform (WTP) from eclipse.org (which I already have)

2. Start the WTP and go to the menu Windows -> Preferences -> Server -> Installed Runtimes. Then add an Apache Tomcat to the runtimes list.

3. To create a servlet project, use the menu File -> New Project -> Web -> Dynamic Web Project.

4. Now we can use the menu File -> New -> Class to create subclasses of javax.servlet.http.HttpServlet and start developing the servlets.

5. Important: Before we can launch the servlet we have to configure the Web Module Deployment Descriptor which is the web.xml in the WEB-INF folder.

6. To launch the servlet, click at the project name in the Project Explorer and use the menu Run -> Run As -> Run on Server.

Keywords: , , , ,

Comments

Popular posts from this blog

"Microsoft.ACE.OLEDB.12.0 provider is not registered on the local machine" Error on Windows 7 (64-bit) + Office 2010 (64-bit) + Visual Studio 2010

If you use (1) Windows 7 (64-bit), and (2) Office 2010 (64-bit), and  (3) Visual Studio 2010 to write an ASP.NET code to connect to Access or Excel database using the Microsoft.ACE.OLEDB.12.0 provider and consistently get the "Microsoft.ACE.OLEDB.12.0 provider is not registered on the local machine" error, try installing the 2007 Office System Driver: Data Connectivity Components , which is basically a Microsoft Access Database Engine 2007 Redistributable for Windows (32-bit) from http://www.microsoft.com/download/en/details.aspx?id=23734 Many forums suggested by Google Search suggest installing the Microsoft Access Database Engine 2010 Redistributable for Windows (32-bit, 64-bit) downloadable from http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=13255 but it wouldn't help because Visual Studio 2010 is a 32-bit application; what you need is a 32-bit Data Connectivity component. The 2010 download will not allow you to install i...

Tips: Mac OS X: Full ANSI Color Support in Terminal.app

I'm trying to switch my Java development platform from Windows XP to Mac OS X Tiger. Wondering how to colorize the Terminal screen, I spent some time googling. From the discussions at the end of this page: macosxhints.com - Add full ANSI color support to Terminal.app Here's a summary of how to enable it: With bash shell as default, simply add export TERM=xterm-color [I prefer this for Linux compatibility] or export TERM=dtterm in the ~/.profile (single-user) or /etc/profile (system-wide) Color terminal is enabled. Use ' ls -G ' (the -G enables color output) to test. Add alias ls='ls -G' in the profile file for convenience. Keywords: mac-os-x , unix , terminal , shell , tips

iTunes: Error 261 while Burning Data CDs/DVDs

Apple Discussions: 261 error while burning MP3 CD. I usually put an aphostrophe (') in the name of playlists and was having error 261 burning CD/DVD data discs since iTunes 5.1. Upgrading to iTunes 6.0 for Windows doesn't help. I was burning a music DVD this morning and had Error 261 again. So I went to Apple iTunes Discussions site and look for a thread on this. Viola! There are many people having the same problem as mine. The thread ends at a point where someone removing ampersands, the '&' symbols, from their playlists and could avoid this error. I tried removing aphostrophes from the name of my playlist because aphostrophe falls into the kind of non-alphabet characters that needs escaping in some programming languages. It works!! Keywords: itunes , windows