Setting Up Tomcat 7 Server Admin Access

This section provides a tutorial example on how to set up admin access (user role, name and password) to Apache Tomcat 7 server. 2 entries are needed in the conf\tomcat-users.xml file: 'role' and 'user'.

Having Tomcat 7 installed and started correctly, the next thing to do is to set up the admin username and password, so that you can manage the server from the Web GUI. This can be done by adding user roles, names and passwords in the server configuration file, tomcat-users.xml.

1. Edit \local\apache-tomcat-7.0.32\conf\tomcat-users.xml with Notepad.

2. Add 2 lines near the end of the file to set up a user role and a user login:

<?xml version='1.0' encoding='utf-8'?>
<!--
... license info ...
-->
<tomcat-users>
<!--
  NOTE:  By default, no user is included in the "manager-gui" role 
  required to operate the "/manager/html" web application.  If you 
  wish to use this app, you must define such a user - the username 
  and password are arbitrary.
-->
<!--
  NOTE:  The sample user and role entries below are wrapped in a 
  comment and thus are ignored when reading this file. Do not forget
  to remove <!.. ..> that surrounds them.
-->
<!--
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <user username="tomcat" password="tomcat" roles="tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>
-->

<role rolename="manager-gui"/>
<user username="herong" password="s3cret" roles="manager-gui"/>

</tomcat-users>

By default, Tomcat 7 supports the following user roles that you can use to set up multiple logins for different level of accesses:

Last update: 2012.

Table of Contents

 About This Book

 JSP (JavaServer Pages) Overview

Tomcat 7 Installation on Windows Systems

 Downloading and Installing Tomcat 7

 Launching Tomcat 7 Server

 Verifying Tomcat 7 Server

Setting Up Tomcat 7 Server Admin Access

 Reviewing Tomcat 7 Server Status Page

 Tomcat Web Application Manager

 My First HTML Page - hello.html

 My First JSP Page - hello.jsp

 JSP Scripting Elements

 Java Servlet Introduction

 JSP Implicit Objects

 Syntax of JSP Pages and JSP Documents

 JSP Application Session

 Managing Cookies in JSP Pages

 JavaBean Objects and "useBean" Action Elements

 Managing HTTP Response Header Lines

 Non-ASCII Characters Support in JSP Pages

 Performance of JSP Pages

 EL (Expression Language)

 Overview of JSTL (JSP Standard Tag Libraries)

 JSTL Core Library

 JSP Custom Tags

 JSP Java Tag Interface

 Custom Tag Attributes

 Multiple Tags Working Together

 File Upload Test Application

 Outdated Tutorials

 References

 PDF Printing Version