Wednesday, February 11, 2009

Tomcat n ANT

Running a web application in TOMCAT using ANT
· Download Tomcat
· Download Ant
· Download JDK
· Set the JAVA_HOME and ANT_HOME
· Create a web project
Create a folder (project) which constitutes of src, web, web/WEB-INF
and doc directories
The src contains the java classes
The web contains the jsp files and htmls and images
The WEB-INF contains the classes directory which will have the
classes files of the java code and the web.xml file for the servlet
configuration.
The doc contains the document of the application
· Compiling(compilation of the java classes and putting them in the build folder), building(building the folders required for the deployment) and deploying (installing the application in the web server) using ANT
· ANT requires a build.xml in the root of the web project folder. If required, build.properties holding the necessary properties for the build.xml is placed in the same folder.
· The build.xml defines the web directory and the other folders where java files are placed. Then by using the javac command, the java files are compiled and placed in the build//WEB-INF folder.
· For deployment, the build folder contents are copied into the webapps folder of the Tomcat Server or a WAR file is made for the project and the same is copied into the webapps folder of the server.Either way, when the server is started, the WAR file contents are extracted into the webapps folder and thereby, the server identifies the application.

No comments:

Post a Comment