Tomcat

Download 5.x

Installation Tutorial

Add Users

1) Configure admin user in TOMCAT_INSTALL_DIR/conf/tomcat-users.xml

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="tomcat"/>
<role rolename="role1"/>
<user username="comp" password="5900" roles="admin,manager"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
<user username="role1" password="tomcat" roles="role1"/>
</tomcat-users>

2) Configure port 8080 in TOMCAT_INSTALL_DIR/conf/server.xml

<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Each Connector passes requests on to the
associated "Container" (normally an Engine) for processing.

By default, a non-SSL HTTP/1.1 Connector is established on port 8080.
You can also enable an SSL HTTP/1.1 Connector on port 8443 by
following the instructions below and uncommenting the second Connector
entry. SSL support requires the following steps (see the SSL Config
HOWTO in the Tomcat 5 documentation bundle for more detailed
instructions):
* If your JDK version 1.3 or prior, download and install JSSE 1.0.2 or
later, and put the JAR files into "$JAVA_HOME/jre/lib/ext".
* Execute:
%JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows)
$JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA (Unix)
with a password value of "changeit" for both the certificate and
the keystore itself.

By default, DNS lookups are enabled when a web application calls
request.getRemoteHost(). This can have an adverse impact on
performance, so you can disable it by setting the
"enableLookups" attribute to "false". When DNS lookups are disabled,
request.getRemoteHost() will return the String version of the
IP address of the remote client.
-->

<!-- 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 -->

Startup/Shutdown

TOMCAT_INSTALL_DIR\bin\startup.bat

TOMCAT_INSTALL_DIR\bin\shutdown.bat

Try it out: http://localhost:8080/

Eclipse Web Tools

1) Installing Web Tools

MyFaces

Download

1) Add Jar files to your Dynamic Web App project WebContent/WEB-INF/lib directory from outside of Eclipse and then select refresh menu option for the context menu of your project.

2) Create a WebContent/pages directory

3) Create an index.jsp containing the following:

<% response.sendRedirect("pages/loginUser.jsf"); %>

4) Create JSPs. JSPs have similar format (loginUser.jsp)

5) Update Dynamic Web App project WebContent/WEB-INF/web.xml

6) Configure Web App project WebContent/WEB-INF/faces-config..xml

7) Write the code