在tomcat中直接发布文件
2013-10-28 21:26
253 查看
index.html文件
css.css文件
script.js文件
web.xml文件:Web.xml文件是整个web应用中最重要的配置文件,它必须放在WEB-INF目录中。在开发web应用时,但凡涉及到对web应用中的web资源进行配置,通通是在web.xml文件中进行设置。
注意:通过web.xml文件把某个web资源配成网站首页。
shouye.html文件
1.开启服务器Tomcat访问HTML文件
2.若想改变地址或端口号来访问html文件的方法是
(1)首先改在tomcat目录下的conf下的文件server.html
(2)改地址前可能会出现问题,找不到文件,解决办法
在c盘下的C:\Windows\System32\Drivers\etc的文件下修改hosts
<html> <head> <title>欢迎进入CSDN页面</title> <!--源信息--><!-- <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="this is my page"> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> --> <!--css文件--> <link rel="stylesheet" type="text/css" href="./css/css.css"> <!--./当前目录下--> <!--../当前目录上一级目录 下--> <!--javascript文件--> <script type="text/javascript" src="./script/script.js"></script> <!--写入css文件<style type="text/css"></style>--> <!--@IMPORT url(""); 放在style标签中--> </head> <body> <div id="mainDiv"> 张小婷</div> </body> </html>
css.css文件
#mainDiv{ text-align:center; background-color:#33CC00; }
script.js文件
alert("你好");
web.xml文件:Web.xml文件是整个web应用中最重要的配置文件,它必须放在WEB-INF目录中。在开发web应用时,但凡涉及到对web应用中的web资源进行配置,通通是在web.xml文件中进行设置。
注意:通过web.xml文件把某个web资源配成网站首页。
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1"> <welcome-file-list> <welcome-file>shouye.html</welcome-file> </welcome-file-list> </web-app>
shouye.html文件
<html> <head> </head> <body> <div >欢迎进入我的网站!!! </div> </body> </html>
1.开启服务器Tomcat访问HTML文件
2.若想改变地址或端口号来访问html文件的方法是
(1)首先改在tomcat目录下的conf下的文件server.html
<Connector port="80" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /><!--改端口号-->
<Host name="yan_mei" appBase="webapps" unpackWARs="true" autoDeploy="true"></Host><!--改地址-->
(2)改地址前可能会出现问题,找不到文件,解决办法
在c盘下的C:\Windows\System32\Drivers\etc的文件下修改hosts
# Copyright (c) 1993-2009 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # # 102.54.94.97 rhino.acme.com # source server # 38.25.63.10 x.acme.com # x client host # localhost name resolution is handled within DNS itself. # 127.0.0.1 localhost # ::1 localhost 127.0.0.1 yan_mei
相关文章推荐
- 在tomcat中配置上一个xml文件,直接访问建立的工程,无需重复发布
- Tomcat项目发布的三种方式;一种:直接将项目(文件)直接复制到tomcat/webapps下二种:在tomcat/conf/server.xml配置tomcat的虚拟路径;
- tomcat下rar,zip,txt,doc等文件直接打开的问题
- Tomcat发布文件
- 解决Eclipse发布后到tomcat后目录下没有class文件
- 求解:tomcat6发布webapp目录中没有JSP文件(访问项目主页404的问题)
- Tomcat 在IE中下载rar文件直接以乱码方式打开解决方案
- eclipse上配置tomcat,发布web工程A,发布文件的位置在哪
- Eclipse EE 发布项目导致 Tomcate 的配置文件 server.xml 还原
- UAP_Studio工具直接访问tomcat某个文件失败
- 重启多个tomcat,可打包成jar文件直接运行
- Tomcat 在IE中下载rar文件直接以乱码方式打开解决方案
- eclipse 项目用tomcat发布更改配置文件之后发布编译的依然是旧的
- lnmp + tomcat 实现 php 和 javaweb程序发布(二级域名直接访问)
- tomcat发布程序不用输入目录直接访问
- tomcat发布后,没有class文件,只有项目目录和properties,xml之类的文件解决办法
- TOMCAT(不用ECLIPSE)直接发布web工程
- 解决ie下载excel文件直接在浏览器打开的问题(tomcat,web项目)
- myeclipse开发发布到tomcat注意不要多文件
- Tomcat WEB-INF目录下的文件无法直接访问