JavaWeb learn the basic processes and tomcat release

web development actually client sends a request to the server, the server gives the corresponding data. As shown below:

 

 What the figures can be found from the beginning to learn

A, tomcat (normal release site is placed at the end, but now used to configure eclipse tomcat, so I have to say)
two, html, js, css (main point static pages also go through Servlet)
three, Servlet Interface
four, JDBC, database
five, jsp, EL, JSTL ensure communication between jsp pages and Servlet

There are many online installation on tomcat not described

①, tomcat directory structure

 

bin: contains some jar, bat file. startup.bat
conf: tomcat configuration server.xml web.xml
lib: tomcat needed to run the jar file
logs: the Run Log File
temp: temporary files
webapps: tomcat project published to the server, it is stored in this directory. 
work (at present do not control): jsp translated into class files to be stored

 ②, how to publish a project to the tomcat

Published in three ways:
1, Web files are copied to / under webapps ROOT

2, configure the virtual path (tomcat / conf / server.xml) to find the host element node   

<-! DocBase: Path address items such as: D: \ xml02 \ person.xml     
path: the corresponding virtual path must be to / beginning.     
对应的访问方式为: http://localhost:8080/a/person.xml --> 
<Context docBase="D:\xml02" path="/a"></Context>

3、配置虚拟路径(tomcat/conf/[enginename(conf/server中engine节点的name属性)]/[hostname(conf/server中engine节点的name属性)]/ 新建一个xml文件)

3.1、 自定义名字(person.xml)

3.2、 在这个文件里面写入以下内容    

<?xml version='1.0' encoding='utf-8'?>    
<Context docBase="D:\xml02"></Context>

3.3、 在浏览器上面访问   http://localhost:8080/自定义名字(person)/xml的名字即可

 ③、给Eclipse配置Tomcat

1. 在server里面 右键新建一个服务器, 选择到apache分类, 找到对应的tomcat版本, 接着一步一步配置即可。

 

 

 

 2. 配置完毕后, 在server 里面, 右键刚才的服务器,然后open  , 找到上面的Server Location , 选择中间的 Use Tomcat installation...

 

 3.测试tomcat服务,创建一个web项目

 

 

 

运行结果:

 

 

这样貌似就完成了。

注意:通过startup.bat启动tomcat时,会一闪而过,有两种可能,一、没有配置JAVA_HOME环境变量,二、jdk版本不匹配

 

Guess you like

Origin www.cnblogs.com/WarBlog/p/12218834.html