JSP - Class2
JSP - Class2
com/t
omcat-installation-
configuration.htm
SP needs any web server; this can be
tomcat by apache, WebLogic by bea, or
WebSphere by IBM.
All jsp should be deployed inside web
server. We will use Tomcat server to run
JSP, this Tomcat server can run on any
platform like windows or linux.
Install tomcat with this step
Tomcat is java based web server, support
jsp ,servlet, and java application, but does
not work as application server. Tomcat
need java environment to execute jsp and
servlet or java class files. This needs to be
JVM installed on server or machine, before
running Tomcat.
Java, JDK, JRE, JVM is available
freely from sun, and other third party
This site provides useful information regarding
installation of Tomcat server. The steps by step of the
installation are shown properly. Every step will followed
by a capture of screen that enable user to better
understand what they are doing currently and what they
will be doing after. This will attract new user of Tomcat
that are using Window platform to further reading on
this site before continuing into installation. In the
subtitle 'Deployment of jsp or servlet in tomcat', user will
be provided with example of creating first servlet. This is
helpful for new user to test the example given and get
knowledge from that before going in depth.
Installation of JDK Java
Download JDK or JRE from sun website
http://
java.sun.com/javase/downloads/index.jsp
Sun provides different executable file for
Windows and Linux operating system version.
Sun provide JDK for Linux in .bin or tar.gz
format, and for Windows .exe format. After
downloading file from sun, install JDK simple
double click or through command prompt .
Default installation directory for java in
Windows is Program file à Java, and
Linux /opt. Tomcat 5.5.17 version requires
at least java1.5 version.
Environment Variable Setting
Environment variable is next to set java home in
system environment. This will help to know
others application where is java is installed and
where java file have to compile. JAVA_HOME
variable name needs to set in environment
variable as variable name and variable value as
the java home directory c:\ jdk1.5.0.
Step to do this setting, go to my computer icon
and right click and go to properties
My computer->right click->properties->
Advance tab->environment variables ->
User variables –> New
Click on new button and new pop up will
open.
In variable value, enter your java path
where java is installed in system.
Tomcat installation
Tomcat installation is of two types. Apache provides self installer
for tomcat installation.This tomcat is in executable binary file.
Download,and install, self installer do all work automatically.Second
is source code extractor. This tomcat installation is also easy as self
installer. Before tomcat installation, check all jvm, java, and
environment path set properly.
Apache tomcat is freely available from apache jakarta site
http://archive.apache.org/dist/tomcat/tomcat-5/
According to per requirement, tomcat is downloaded in form of
binaries or source code.
We are using zipped pack for windows installation. Download zipped
binaries code latest one from this site.Unzip this code and c:\ drive
and anywhere desired directory
After unzipped directory system will like that
This is means that tomcat is installed
properly and ready to run web server.
Open bin directory and double click on
startup.bat file. Startup.bat will open in
dos command prompt
After starting tomcat, check tomcat in web
browser by typing localhost:8080 in
address bar
http://localhost:8080/
Setting up tomcat port
Apache Tomcat Configuration Tomcat
use 8080 port instead of 80 port. User can
easily change default port from tomcat.
Open c:/tomcat/config/server.xml folder in
tomcat installed and
open server.xml file.
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080
-->
<Connector port="8080"
maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25"
maxSpareThreads="75"
enableLookups="false" redirectPort="8443"
acceptCount="100"
connectionTimeout="20000"
disableUploadTimeout="true" />
<!-- Note : To disable connection timeouts, set
connectionTimeout value
to 0 -->
In connector port change 8080 to 80, now
save this save and shutdown.bat tomcat
and startup.bat tomcat.This time user
need not to write 8080 port
in http://localhost/
Servlet invoker
Servlet container of tomcat engine doesn’t start
automatically. WEB-INF deployment descriptor needs to
tell servlet engine, where your servlet and mapping of
servlet.This is is can be done without any setting
through servlet invoker. We just need to uncommented
the code in web.xml in config folder.Servlet invoker
automatically load servlet in context and map it.
Open c:/tomcat/config/web.xml and edit this code as
shown.
First uncommented invoker then servlet mapping
<!-- -->
<!-- debug Debugging detail level for messages
logged -->
<!-- by this servlet. [0] -->
<servlet>
<servlet-name>invoker</servlet-name>
<servlet-class>
org.apache.catalina.servlets.InvokerServlet
</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<!-- The mapping for the invoker servlet -->
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
<!-- The mapping for the JSP servlet -->
If you are using tomcat 6, need to define
privileges for context. In tomcat 5.5.x
version no need to define privileges for
context. Tomcat 5.5.x take automatically.
Privileges setting can be done in
tomcat/conf/context.xml file. Add this line
<Context reloadable="true"
privileged="true">