Thursday, June 16, 2005

How to ease Java web development

Sometimes it can be a tough ride, when you are *starting* to work with java's web development tools - servlets and JSPs. You have to have very good configuration skills, and you must have prior knowledge of XML - two things i felt, helped me configure my JCreator IDE to compile java web apps, and to integrate it with Tomcat.

Web development using JSP/Servlets can be a rewarding experience. Once you are in total control, you will start thanking James Gosling and all those java language architects for coming up with such a beautiful architecture. These days i am reading Head First: Servlets & JSP to write the SCWCD exams. This book uses a very unconventional style in presenting the material. Its like a comic book, I would recommend it to all those people out there who hate reading books, and need to read a book on JSPs and servlets. It will keep you hooked up as long as you can even imagine. I feel like reading it, even when i dont feel like doing anything.

Going back to servlets/JSP, its really important to integrate your IDE with your web-server when you are developing java web applications. It saves you a lot of time. It would be too cumbersome to re-compile, package into a WAR, and redeploy everytime. Thanks to the ANT tool. The ANT tool is an all-purpose java building tool. The Apache ant project maintains the ANT tool, and it can be downloaded freely from their site.

The ANT tool is much like the make tool. However, it claims to be platform-independent, letting you build your application across different platforms. But, lets not get into all that; the good thing about JCreator IDE is that it can be integrated with the ANT tool to help re-compile, package and redeploy a web application all with the click of a button!

The steps in doing the integration are as follows:
- Download Jakarta ANT
- copy the /server/catalina-ant.jar file from your tomcat-home folder, to the /lib folder of your ANT installation
- Bring out the ANT tool window in JCreator using views -> other windows -> ANT tool
- configure the build.xml file to set the correct tomcat manager user/password and URL of the admin page, in order to allow ANT to redeploy. Unable to do this properly, will cause a net connection exception.
- You are all set to compile, install (ANT tool options) your web application

What you didnt have to do:
- Set all the library paths for the servlets to compile, and run (servlet.jar, webserver.jar).
- re-compile, re-package into WAR and redeploy everytime you modify your code. phew!

0 Comments:

Post a Comment

<< Home