一、get or post?
We can send data to the data processing page by both the GET and POST methods of a form. Both methods are used in form data handling where each one has some difference on the way they work. We will discuss some of the differences.
As you have seen there is a character restriction of 255 in the URL. This is mostly the old browsers restriction and new ones can handle more than that. But we can't be sure that all our visitors are using new browsers. So when we show a text area or a text box asking users to enter some data, then there will be a problem if more data is entered. This restriction is not there in POST method.
In GET method data gets transferred to the processing page in name value pairs through URL, so it is exposed and can be easily traced by visiting history pages of the browser. So any login details with password should never be posted by using GET method.
As the data transfers through address bar ( URL ) there are some restrictions in using space, some characters like ampersand ( & ) etc in the GET method of posting data. We have to take special care for encoding ( while sending ) and decoding ( while receiving ) data if such special characters are present.
There are some special cases where advantage of using GET method is , one can store the name value pairs as bookmark and directly use them by bypassing the form.
二、URL解析
- 协议
- 服务器:所请求的物理服务器的唯一名字,这个名字映射到一个唯一IP地址
- 端口:URL这一部分是可选的,一个服务器可以支持多个端口。一个服务器应由一个端口标识。如在URL中无指定端口,默认为80,这正是web服务器的默认端口。
- 路径:请求的资源在服务器上的路径。这是一个UNIX格式的路径,因为早期的web服务器采用UNIX系统。
- 资源:请求的内容名字。
三、端口
- TCP端口就是一个数字而已。
- 这是一个16位的数,标识服务器硬件上一个特定的软件程序。
- Internet Web(HTTP)服务器软件在端口80上运行,这是一个标准。
- Telnet服务器在23端口运行
- FTP在21端口上运行。
- POP3邮件服务器在37上。
- SMTP---25
- HTTPS---443
- 服务器上有65536个端口(0-65535),而0-1023的TCP端口号已经保留,由一些知名的服务使用,你自己定制的服务器程序不要使用这些端口。
四、一个小小的SERVLET编写,编译,部署,运行过程:
- 建立一个开发源码以及编译的目录结构:
- src用来放置源文件;classes放置编译好的.class文件;etc放置配置文件web.xml
- 编写一个简单的servlet,放在目录p\src\com\test下(也可以直接放在目录\src下)
package com.test;
public class Ch1Servlet extends javax.servlet.http.HttpServlet {
public void doGet (javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException {
java.io.PrintWriter out = response.getWriter();
java.util.Date now = new java.util.Date();
out.println("<h1 align='center'> CurrentTime is: " + now + "</h1>");
}
}
- 编译文件.class应该放到目录“\classes”下
- 在目录“\etc”下编写配置文件web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<Servlet>
<Servlet-name>test1.do</Servlet-name>
<Servlet-class>com.test.Ch1Servlet</Servlet-class>
</Servlet>
<Servlet-mapping>
<Servlet-name>test1.do</Servlet-name>
<url-pattern>/test1.do</url-pattern>
</Servlet-mapping>
</web-app>
- 至此,完成编写编译阶段,进入部署阶段。在TOMCAT的目录“\webapps”下部署如下目录:
- 将源文件开发阶段的目录“\classes\”下的所有目录拷到部署目录“\classes\”下。
- 新建的web.xml放到部署目录“\WEB-INF\”下
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<Servlet>
<Servlet-name>test1.do</Servlet-name>
<Servlet-class>com.test.Ch1Servlet</Servlet-class>
</Servlet>
<Servlet-mapping>
<Servlet-name>test1.do</Servlet-name>
<url-pattern>/test1.do</url-pattern>
</Servlet-mapping>
</web-app>
- 开启tomcat,即可在浏览器端输入“http://localhost:8080/p/test1.do”访问编写的“Ch1Servlet.class”这个servlet了。
- 大小: 6.2 KB
- 大小: 7.9 KB
- 大小: 2.6 KB
- 大小: 5.3 KB
分享到:
相关推荐
时间序列分类:基于深度学习的时间序列分类
(66条消息) TensorFlow2.0 学习笔记(四):迁移学习(MobileNetV2)_种树最好的时间是10年前,其次是现在!!!-CSDN博客.url
学习时间与分数数据集,25条数据
时间序列预测与深度学习:文献综述与应用实例.pdf
中文名: The Pragmatic Bookshelf开发丛书-Flash敏捷开发:快速学习敏捷软件开发 原名: Agile in a Flash: Speed-Learning Agile Software Development 作者: Jeff Langr Tim Ottinger 资源格式: PDF 版本: 文字版 ...
TSPNet:通过时间语义金字塔进行手语翻译的分层特征学习的代码实现 TSPNet: Hierarchical Feature Learning via Temporal Semantic Pyramid for Sign Language Translation
PanoFlow:学习360°用于周围时间理解的光流
出版时间: 1992 版次: 一版一印 装帧: 平装 开本: 32开 页数: 434页 张景中(1936- ),河南省汝南县人。曾用名井中。中国科学院院士。现任华中师范大学国家数字化学习工程技术研究中心学术委员会主任。1954年进入...
《时间序列分析及应用:R语言 原书第2版 》以易于理解的方式讲述了时间序列模型及其应用 主要内容包括:趋势 平稳时间序列模型 非平稳时间序列模型 模型识别 参数估计 模型诊断 预测 季节模型 时间序列回归模型 异...
作者: 吕金虎、陆君安、陈士华 著 出版社: 武汉大学出版社 ISBN: 9787307032644 出版时间: 2005-05 版次: 1 装帧: 平装 开本: 32开 纸张: 胶版纸 页数: 237页
Python数据分析基础教程:NumPy学习指南(第2版).xmind该文档详细且完整,值得借鉴下载使用,欢迎下载使用,有问题可以第一时间联系作者~
作者: Christopher M. Bishop, Hugh Bishop 书名: Deep Learning: Foundations and Concepts 发布时间: 2023 关键词: 深度学习, 人工智能
他们按时间排序,首先查看最近的论文。 我将更新最近的论文,并在这些论文中添加注释。 您应该找到带有星号的论文和软件更重要或更受欢迎。 目录 文件 模型动物园 2012 | AlexNet:使用深度卷积神经网络进行ImageNet...
2.内容:基于LSTM深度学习网络的时间序列预测matlab仿真+操作视频 3.用处:用于LSTM深度学习网络编程学习 4.指向人群:本硕博等教研学习使用 5.运行注意事项: 使用matlab2021a或者更高版本测试,运行里面的Run...
作者: 唐秀颖 出版社: 上海辞书出版社出版 出版时间: 1991-02 版次: 1 印刷时间: 1997-08 印次: 6 装帧: 精装 开本: 32开
系列的第一篇概览了一下深度学习中的基本概念。...生活中的所有事物都是与时间相关的,也就形成了一个序列。为了对序列数据(文本、演讲、视频等)我们可以使用神经网络并导入整个序列,但是这样我们的数据输入尺寸
参加过四川省中小学教师继续教育网远程培训学习的教师都知道:在学习完十至二十分钟之后必须点击“更新学习时间”按钮才会计时,有的还要输入验证码才能更新学习时间。这样每隔十几分钟点一次很是烦人,所以本人编写...
时代光华学习课程:时间管理:高效职业人士必备技能-考试题汇编.doc
主题班会课件:珍惜时间好好学习中队班会.ppt
者: 刘吉佑,莫骄编 出版社: 北京邮电大学出版社 ISBN: 9787563531417 出版时间: 2012-08 版次: 1 印刷时间: 2016-07 印次: 5 装帧: 平装 开本: 16开 页数: 253页