The advance of Java -- Html, Servlet(Day07)

来源:互联网 发布:linux如何退出终端 编辑:程序博客网 时间:2024/05/29 02:14

1. CS/BS:

①CS: Client-Server = Client + APP Server + DB

②BS: Broswer-Server = Browser + Web Server + DB (HTTP)

2. HTML:

①Lable: text, checkbox, option, select

②Attrbute: id, name, style

③JS: alert();

④DOM: document.getElementById();

3. Servlet: using to handle data and return it to foreground


①Tomcat: including HTTP server and Web container

(1)Install:

1、Installing apache-tomcat-7.0.73.exe under D:\Tomcat 7.0

2、Creating CATALINA_HOME and add D:\Tomcat 7.0;

3、Adding %CATALINA_HOME%\lib\servlet-api.jar in CLASSPATH

4、Adding  %CATALINA_HOME%\bin in Path

5、Entering D:\Tomcat 7.0\bin, and run tomcat7.exe.

6、Opening browser and input http://localhost:8080/ , if you can see the interface of Tomcat, it worked.

7、uninstall tomcat:uninstall it in control panel.

*Sometimes, the servlet-api.jar might not add in our project, so we need to add it manually.First of all, right click your project, and choose build path Secondly,add external jar; then find Tomcat 7.0/lib/servlet-api.jar.

(2)Setting in Eclipse:

1. click windown, preferences, server, runtime environment.

2. click add, choose Apache Tomcat7.0 and then click next,  choose the right path of directory that you install Tomcat.

(3)The step of Servlet:

Browser(url)-->
web.xml-->
url-pattern-->
servlet-name-->
servlet-name-->
servlet-class-->
full-qualified name-->
reflect to Servlet-->
call method of service

*<welcome-first-list>: default path

(4)Error message:

404: cannot find path

500: execution error

(5)HTTP(HyperText  Transfer Protocol):

①stateless protocol

②request package is encapsulated in HttpServletRequest request and response package is encapsulated in HttpServletResponse response.


原创粉丝点击