create a war file using jsp code
Today we are going to learn how to create a war file using jsp code from eclipse and deploy in tomcat,A War is defined as web archive file created specially for running webapplication when you placed an war file in webapps folder of tomcat it is deployed automatically when you start tomcat so lets start now,The “ant tool” is needed to create the war file for that download the ant from http://ant.apache.org and create a file named build.xml this xml file must be placed in root of your project folder in eclipse and add the following code in it.
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="Deploy From Eclipse to Tomcat" basedir=".">
<property name="warfile" value="nameofthewartobecreated"/>
<target name="unpack">
<unwar src="${warfile}.war" dest="${warfile}" />
</target>
<target name="create">
<war destfile="${warfile}.war" webxml="WebContent/WEB-INF/web.xml" update="true">
<classes dir="build\classes"/>
<fileset dir="WebContent">
<exclude name="WEB-INF/web.xml"/>
</fileset>
</war>
</target>
<target name="copy">
<copy todir="C:\Program Files\Apache Software Foundation\Tomcat 5.5\" overwrite="true">
<fileset dir=".">
<include name="*.war"/>
</fileset>
</copy>
</target>
<target name="deploy">
<antcall target="create"/>
<antcall target="copy"/>
</target>
</project>
In eclipse->your projects’s build.xml->right click build.xml->Run as->Ant Build->check the needed checkboxes
unpack
copy
create
deploy
click run
You can also use ant tool from command prompt to create the war file ArcGIS Java one of the ant tool available in internet,Now the war is created in your project folder ,Any doubt ask us happy coding.




