9.4. Tomcat

简介:

web.xml

		
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://xmlns.jcp.org/xml/ns/javaee"
	xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
	id="WebApp_ID" version="3.1">
	<display-name>m.cf88.com</display-name>
	<welcome-file-list>
		<welcome-file>index.html</welcome-file>
		<welcome-file>index.htm</welcome-file>
		<welcome-file>index.jsp</welcome-file>
		<welcome-file>default.html</welcome-file>
		<welcome-file>default.htm</welcome-file>
		<welcome-file>default.jsp</welcome-file>
	</welcome-file-list>

	<servlet>
        <servlet-name>netkiller</servlet-name>
        <servlet-class>
            org.springframework.web.servlet.DispatcherServlet
        </servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>netkiller</servlet-name>
        <url-pattern>/welcome.jsp</url-pattern>
        <url-pattern>/welcome.html</url-pattern>
        <url-pattern>*.html</url-pattern>
    </servlet-mapping> 

</web-app>
		
		

netkiller-servlet.xml

		
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="
        http://www.springframework.org/schema/beans     
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/mvc 
        http://www.springframework.org/schema/mvc/spring-mvc.xsd
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context.xsd">

	<context:component-scan base-package="cn.netkiller.controller" />

	<bean id="viewResolver"
		class="org.springframework.web.servlet.view.UrlBasedViewResolver">
		<property name="viewClass"
			value="org.springframework.web.servlet.view.JstlView" />
		<property name="prefix" value="/WEB-INF/jsp/" />
		<property name="suffix" value=".jsp" />
	</bean>

</beans>		
		
		



原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。

目录
相关文章
|
4月前
|
XML Java 应用服务中间件
一文了解Tomcat
Tomcat是一个开放源代码的Java Servlet容器,它实现了Java Servlet和JavaServer Pages(JSP)规范。由于Tomcat是一个Java应用程序,它可以在多个操作系统上运行,如Windows、Linux和Mac OS等。Tomcat的主要作用是提供一个运行Java Web应用程序的环境。它可以处理从客户端发送的HTTP请求,并将请求传递给相应的Java Servlet或JSP进行处理。Servlet和JSP是用Java编写的服务器端组件,用于生成动态的Web内容。
67 4
|
1月前
|
网络协议 Java 应用服务中间件
什么是tomcat?tomcat是干什么用的?
什么是tomcat?tomcat是干什么用的?
|
5月前
|
XML Java 应用服务中间件
Tomcat使用总结
Tomcat使用总结
44 0
|
7月前
|
网络协议 Java 应用服务中间件
你还在用tomcat ?out了
Netty作为高性能服务器讲解
|
8月前
|
XML Java 应用服务中间件
tomcat详解
tomcat详解
126 0
|
8月前
|
前端开发 网络协议 Java
|
11月前
|
XML 应用服务中间件 Shell
|
缓存 NoSQL 数据可视化
|
Java Unix 应用服务中间件
tomcat介绍
tomcat介绍
|
应用服务中间件
Tomcat 介绍与使用
Tomcat 介绍与使用
Tomcat 介绍与使用