Está en la página 1de 5

ESTRUCTURA TOMCAT

1. Descargar Tomcat 7 desde : http://tomcat.apache.org/download-70.cgi 2. Descargar JDK6 SE desde : 3. Instalar Tomcat 7. Directorio instalacion : C:\Archivos de programa\Apache Software Foundation Parametros : Server shutdown port : 8005 HTTP/1.1 Connector port : 8080 (si no esta en uso) AJP/1.3 Connector Port : 8009 Windows service name : Tomcat7 Create shortcuts for all users : YES Tomcat Administrator Login : cresan Tomcat Administrator Password : cresan Roles : admin-gui,manager-gui

http://www.oracle.com/technetwork/java/javase/downloads/index.html

4. Para crear un nuevo sitio web se crea un carpeta que cuelgue de : C:\Archivos de programa\Apache Software Foundation\Tomcat 6.0\webapps Por ejemplo WebCurso 5. Se copia la carpeta WEB-INF y el fichero web.xml de : C:\Archivos de programa\Apache Software Foundation\Tomcat 6.0\webapps\ROOT a esta carpeta (WebCurso) 6. Se crea la carpeta classes debajo de la carpeta WEB-INF de este sitio 7. Se copia una clase en la ruta : C:\Archivos de programa\Apache Software Foundation\Tomcat 6.0\webapps\WebCurso\WEB-INF\classes Se modifica el fichero web.xml de la ruta : C:\Archivos de programa\Apache Software Foundation\Tomcat 6.0\webapps\WebCurso\WEB-INF Y se incluye el servlet que queramos ejecutar. Contenido de web.xml : <?xml version="1.0" encoding="ISO-8859-1"?> <!-Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership.

ESTRUCTURA TOMCAT
The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> Esta es la descripcin de la aplicacin al entrar por el manager <display-name>Welcome to Tomcat</display-name> <description> Welcome to Tomcat </description> Este es el documento por defecto de la aplicacin <welcome-file-list> <welcome-file>rias.html</welcome-file> </welcome-file-list> Este es el servlet a incluir <servlet> <servlet-name>helloservlet</servlet-name> <servlet-class>helloservlet</servlet-class> </servlet> Ruta donde lo buscara <servlet-mapping> <servlet-name>helloservlet</servlet-name> <url-pattern>/servlet/helloservlet</url-pattern> </servlet-mapping> Seguridad y metodos permitidos <security-constraint> <display-name>Example Security Constraint</display-name> <web-resource-collection> <web-resource-name>Protected Area</web-resource-name> <!-- Define the context-relative URL(s) to be protected --> <url-pattern>/jsp/security/protected/*</url-pattern> <!-- If you list http methods, only those methods are protected --> <http-method>DELETE</http-method> <http-method>GET</http-method> <http-method>POST</http-method> <http-method>PUT</http-method> </web-resource-collection>

ESTRUCTURA TOMCAT
<auth-constraint> <!-- Anyone with one of the listed roles may access this area --> <role-name>tomcat</role-name> <role-name>role1</role-name> </auth-constraint> </security-constraint> </web-app> Para ejecutarlo deber teclear : http://localhost:8080/WebCurso/servlet/helloservlet

ESTRUCTURA TOMCAT

Estructura sitio Tomcat


Las nuevas aplicaciones se cuelgan de webapps. Contenido de las carpetas de la aplicacin : Raiz aplicacin : o Html

Raiz\WEB-INF o web.xml

Aqu se configura el comportamiento de la aplicacin, los servlet, pgina de inicio, metodos permitidos, Raiz\WEB-INF\classes o Clases java

Raiz\WEB-INF\lib o Librerias java

ESTRUCTURA TOMCAT

Administracin Tomcat
Para administrar Tomcat hay que acceder por el navegador al servidor web indicando el puerto de conexin http a la ruta raiz.

También podría gustarte