Java Web-Tomcat
1 Tomcat
这个软件用来装载你的javaweb程序,可以称它为web容器,你的jsp/servlet程序需要运行在Web容器上,Web容器有很多种,JBoss、WebLogic等等,Tomcat是其中一种。tomcat是一种web服务器,也可以称作运行在服务器(物理意义上的计算机)上的一种软件包。用来对服务器上的HTML文档提供访问权限控制。
1.1 启动Tomcat
tomcat下载解压后,在bin文件下找到启动项
1.2 在浏览器上查看
打开浏览器,输入http://localhost:8080/ 进入以下界面
1.3 关闭Tomcat
1.4 修改端口号
在conf文件下找到server.xml文件
2 创建一个web项目
创建一个html
2.1 将开发工具和tomcat集成在一起
2.2 将项目和tomcat关联
2.3 启动
2.4 第二次创建项目时有所不同
2.5 第二次创建的勾选项,可使得在开发工具里看见结果
2.5.1 web.xml文件
在创建项目时的勾选项,会创建一个web.xml文件
web.xml文件
<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>
欢迎列表,该列表中的内容会作为web程序启动的默认页面,在启动时可写也可不写
http://localhost:8080/helloWeb/index.html 或 http://localhost:8080/helloWeb/