部署Web应用

本文介绍了两种手工部署Web应用到Tomcat的方法。第一种是直接在Tomcat的webapps目录下创建并配置Web应用目录,包括创建必要的文件夹、web.xml配置以及主页和资源。第二种方式涉及复制应用目录到外部路径,并修改server.xml配置来添加新的Context。
摘要由CSDN通过智能技术生成

采用两种方式手工部署Web应用。

第一种方式实现思路:

  1. 在Tomcat的webapps目录下,创建一个Web应用目录News;
  2. 在News下分别创建WEB-INF/classes和WEB-INF/lib两个文件夹;
  3. 创建web.xml文件,添加到WEB-INF目录下,将其默认主页设置为index.html;
  4. 为News应用添加主页index.html、后台主页admin.html以及CSS、images、newspages子目录及相关资源;
  5. 将News应用部署到Tomcat中,启动Tomcat服务器,通过IE进行访问。
    第二种方式实现思路:
    1)将上述News应用目录从webapp目录下拷贝到D:\News路径下;
    2)在%Tomcat_home%\conf路径下的server.xml的标签下增加一行代码:

    3)保存server.xml文件,启动Tomcat服务器;
    4)在IE浏览器地址栏输入:http://localhost:8080/news/index.html 访问该应用。
    在这里插入图片描述

项目:
在这里插入图片描述
admin.css:

@charset "GBK";
/* CSS Document */
*{
    margin:0; padding:0;}
body{
    font:12px/20px Tahoma;}
table{
    border-collapse:collapse;}
img{
    border:0;}
li{
    list-style:none;}

a{
    color:#333; text-decoration:underline;}
a:hover{
    color:#f00; text-decoration:underline;}

#header{
    clear:both; margin:0 auto; margin-top:15px; width:947px; height:116px; border:1px solid #dfdfdf; background:url(../Images/topbg.gif) repeat-x;}
	#welcome{
    padding:6px 0 0 10px; height:30px;}
	#nav{
    clear:both; padding:0 10px;}
		#logo{
    float:left; background:#f00;}
		#a_b01{
    float:right; width:781px; margin:4px 0 0 0; background:#f00;}
		
#admin_bar{
    clear:both; width:947px; margin:14px auto 0; height:25px; background:url(../Images/admin_bar.gif) repeat-x; border:1px #d5d9da solid; border-top:0;}
	#status{
    float:left; width:550px; padding:2px 0 0 20px;}
	#channel{
    float:right; width:360px;}
		#channel li{
    float:left; width:66px; height:22px; line-height:22px; text-align:center; background:url(../Images/channel_bg.gif) no-repeat; margin:0 3px;}
		#channel li a{
    color:#2a3668; text-decoration:none;}
		#channel li a:hover{
    color:#f60; text-decoration:underline;}
		#channel li#name{
    background:none; width:auto;}
		
#main{
    clear:both; width:947px; height:100%; overflow:hidden; margin:14px auto 0;}
	#opt_list{
    float:left; width:130px; padding:10px 0 0 14px;}
	#opt_area{
    float:right; width:770px; margin:14px 0 0 0;}
		#opt_type{
    height:28px; padding:4px 0 0 18px; margin:0 0 20px 0; font:600 14px/24px Arial; background:url(../Images/opt_name.gif) no-repeat;}
		#opt_area p{
    margin:10px 0;}
		.opt_input{
    margin-left:6px; border:1px solid #999; height:18px; line-height:18px; width:200px;}
		.opt_sub{
    height:25px; background:url(../Images/opt_sub.gif) repeat-x; text-align:center; border:1px solid #ceced0; font:12px/25px Arial; padding:0 6px; letter-spacing:3px;}
		.classlist{
    clear:both; margin-top:10px;}
			.classlist li{
    position:relative; line-height:22px; background:url(../Images/arrow.gif) no-repeat 0 10px; padding:0 130px 0 8px;}
			.classlist li.space{
    background:none; height:22px;}
			.classlist li span{
    position:absolute; top:-1px; *top:-4px; right:16px;}
#site_link{
    clear:both; width:947px; margin:35px auto 0; background:#e3e3e3; border-top:2px #0c7eb2 solid; height:26px; line-height:28px; text-align:center;}
#site_link a{
    color:#000; text-decoration:none;}
#site_link a:hover{
    color:#f00; text-decoration:underline;}
#site_link span{
    margin:0 6px;}
		
	
#friend{
    clear:both; width:947px; height:140px; margin:0 auto;}
	.friend_t{
    height:24px; border:1px solid #b3b7ba; background:url(../Images/friend_t.gif) repeat-x; padding:4px 0 0 10px;}
	.friend_list{
    height:110px; overflow:hidden; background:url(../images/firend_bg.gif) repeat-x; border:1px solid #bfd0d5; border-top:0;}
	.friend_list ul{
    margin:14px 10px 0;}
	.friend_list li{
    float:left; margin-right:10px; white-space:nowrap;}

#footer{
    clear:both; width:947px; margin:14px auto 0; text-align:center;}
	#footer p{
    font:14px/24px Arial; color:#999;}
	#footer p.copyright{
    color:#333; margin-top:15px;}

main.css

@charset "GBK";
/* CSS Document */
*{
    margin:0; padding:0;}
body{
    font:12px/20px Tahoma;}
table{
    border-collapse:collapse;}
img{
    border:0;}
li{
    list-style:none;}

a{
    color:#335884; text-decoration:none;}
a:hover{
    color:#f00; text-decoration:underline;}

#header{
    clear:both; position:relative; margin:0 auto; margin-top:15px; width:947px; height:116px; border:1px solid #dfdfdf; background:url(../Images/topbg.gif) repeat-x;}
	#top_login{
    padding:6px 0 0 10px;}
		.login_input{
    height:19px; line-height:19px; width:118px; border:none; background:url(../Images/login_input.gif) no-repeat; margin:0 14px 0 6px;}
		.login_sub{
    width:51px; height:19px; border:none; background:url(../Images/login_sub.gif) no-repeat;}
		.login_link{
    text-decoration:underline; margin:0 6px;}
		#friend_logo{
    position:absolute; top:6px; right:6px;}
		
	#nav{
    clear:both;}
		#logo{
    float:left; width:145px; margin:8px 0 0 12px;}
		
		#mainnav{
    float:right; margin:10px 10px 0 0 ;}
		#mainnav ul{
    clear:both;}
		#mainnav ul li{
    float:left; margin:0 2px; padding-left:6px; background:url(../Images/nav_leftdot.gif) no-repeat 0 8px; line-height:24px;}
		#mainnav ul li a{
    color:#333;}
		#mainnav ul li.leftLineTop{
    background-image:url(../Images/nav_leftline.gif);}
		#mainnav ul li.headLi{
    background:none;}
		
		
#container{
    clear:both; width:947px; height:100%; overflow:hidden; margin:14px auto 0;}
	.sidebar{
    float:left; width:157px;}
		.sidebar h1{
    clear:both;}
		.side_list{
    height:250px; background:url(../Images/sidebarbg.gif) no-repeat; margin:2px 0 12px;}
	.main{
    float:right; width:787px;}
		.class_type{
    background:url(../Images/class_bg.gif) no-repeat right 8px; height:40px; padding:0 0 0 14px;}
		.content{
    float:left; width:500px; border-right:1px solid #eff0f4; margin:16px 0 0 10px;}
			.class_date{
    font:12px/20px Arial; border-bottom:1px solid #d4d6d9; margin-right:10px;}
				#class_month{
    font-weight:600;}
				#class_month a{
    margin:0 7px; *margin:0 5px;}
				#class_day{
    line-height:30px;}
			.classlist{
    clear:both; margin-top:10px;}
			.classlist li{
    position:relative; line-height:22px; background:url(../Images/arrow.gif) no-repeat 0 10px; padding:0 130px 0 8px;}
			.classlist li.space{
    background:none; height:22px;}
			.classlist li span{
    position:absolute; top:-1px; *top:-4px; right:16px;}
		.picnews{
    float:right; width:250px; text-align:center; margin:16px 0 0 0;}
		.picnews li{
    margin-bottom:10px;}
		
	
#friend{
    clear:both; width:947px; height:140px; margin:0 auto;}
	.friend_t{
    height:24px; border:1px solid #b3b7ba; background:url(../Images/friend_t.gif) repeat-x; padding:4px 0 0 10px;}
	.friend_list{
    height:110px; overflow:hidden; background:url(../images/firend_bg.gif) repeat-x; border:1px solid #bfd0d5; border-top:0;}
	.friend_list ul{
    margin:14px 10px 0;}
	.friend_list li{
    float:left; margin-right:10px; white-space:nowrap;}

#footer{
    clear:both; width:947px; margin:14px auto 0; text-align:center;}
	#footer p{
    font:14px/24px Arial; color:#999;}
	#footer p.copyright{
    color:#333; margin-top:15px;}

read.css

@charset "GBK";
/* CSS Document */
*{
    margin:0; padding:0;}
body{
    font:12px/20px Tahoma;}
table{
    border-collapse:collapse;}
img{
    border:0;}
li{
    list-style:none;}

a{
    color:#335884; text-decoration:none;}
a:hover{
    color:#f00; text-decoration:underline;}

#header{
    clear:both; position:relative; margin:0 auto; margin-top:15px; width:947px; height:116px; border:1px solid #dfdfdf; background:url(../Images/topbg.gif) repeat-x;}
	#top_login{
    padding:6px 0 0 10px;}
		.login_input{
    height:19px; line-height:19px; width:118px; border:none; background:url(../Images/login_input.gif) no-repeat; margin:0 14px 0 6px;}
		.login_sub{
    width:51px; height:19px; border:none; background:url(../Images/login_sub.gif) no-repeat;}
		.login_link{
    text-decoration:underline; margin:0 6px;}
		#friend_logo{
    position:absolute; top:6px; right:6px;}
		
	#nav{
    clear:both;}
		#logo{
    float:left; width:145px; margin:8px 0 0 12px;}
		
		#mainnav{
    float:right; margin:10px 10px 0 0 ;}
		#mainnav ul{
    clear:both;}
		#mainnav ul li{
    float:left; margin:0 2px; padding-left:6px; background:url(../Images/nav_leftdot.gif) no-repeat 0 8px; line-height:24px;}
		#mainnav ul li a{
    color:#333;}
		#mainnav ul li.leftLineTop{
    background-image:url(../Images/nav_leftline.gif);}
		#mainnav ul li.headLi{
    background:none;}
		
		
#container{
    clear:both; width:947px; height:100%; overflow:hidden; margin:14px auto 0;}
	.sidebar{
    float:left; width:157px;}
		.sidebar h1{
    clear:both;}
		.side_list{
    height:250px; background:url(../Images/sidebarbg.gif) no-repeat; margin:2px 0 12px;}
	.main{
    float:right; width:787px;}
		.class_type{
    background:url(../Images/class_bg.gif) no-repeat right 8px; height:40px; padding:0 0 0 14px;}
		.content{
    float:right; width:787px; border-right:1px solid #eff0f4; margin:16px 0 0 10px;}
			
			.classlist{
    clear:both; margin-top:10px;}
			.classlist li{
    position:relative; line-height:22px; background:url(../Images/arrow.gif) no-repeat 0 10px; padding:0 130px 0 8px;}
			.classlist li.space{
    background:none; height:22px;}
			.classlist li span{
    position:absolute; top:-1px; *top:-4px; right:16px
  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值