📄 处理httppostget请求.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN" lang="zh-CN"><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="Keywords" content="hugetlbfs,PostgreSQL,Postini,HTTP">
<meta name="Description" content="通常,service方法用来从客户请求(request)中提取信息,访问扩展资源,并基于上面的信息提供响应(response)。"><title>如何处理HTTP POST/GET请求 - ZDNet China软件技术专区</title>
<link href="%B4%A6%C0%EDHTTPPOSTGET%C7%EB%C7%F3_files/zdcn_main.css" rel="stylesheet" type="text/css">
<link href="%B4%A6%C0%EDHTTPPOSTGET%C7%EB%C7%F3_files/article.css" rel="stylesheet" type="text/css">
<style type="text/css" media="all">
</style>
<link href="%B4%A6%C0%EDHTTPPOSTGET%C7%EB%C7%F3_files/header.css" rel="stylesheet" type="text/css"><style type="text/css">
<!--
.specialtext1 {font-size: 12px}
-->
</style><link href="%B4%A6%C0%EDHTTPPOSTGET%C7%EB%C7%F3_files/modules.css" rel="stylesheet" type="text/css"><!-- base --></head><body>
<!--/header-->
<!--include virtual="/i/software_zone/div/index_header.htm"-->
<div id="newhead">
<div class="compy_top">
<h3>CNET中国旗舰网站</h3>
<p><a href="http://www.zdnet.com.cn/" target="_blank">ZDNet China</a> | <a href="http://www.cnetnews.com.cn/" target="_blank">CNET科技资讯网</a><a href="#" target="_parent"></a> | <a href="http://it.ccgp.gov.cn/" target="_blank">政府采购</a> | <a href="http://www.zdnet.com.cn/industryunion/industry_union.htm" target="_blank" class="red">行业网站联盟</a></p>
</div>
<div class="navigation">
<div class="newlogo">
<a href="http://www.zdnet.com.cn/" title="ZDNet China 置顶网是中国最大的企业级IT资源门户">ZDNet China 置顶网是中国最大的企业级IT资源门户</a>
<div id="it_services"></div>
</div>
<div class="fixednav">
<ul class="firstnav">
<li class="over2w"><h3><a href="http://www.zdnet.com.cn/">首页</a></h3></li>
<li class="over4w"><h3><a href="http://net.zdnet.com.cn/">网络安全</a></h3></li>
<li class="over2w"><h3><a href="http://stor-age.zdnet.com.cn/">存储</a></h3></li>
<li class="over3w"><h3><a href="http://server.zdnet.com.cn/">服务器</a></h3></li>
<li class="over2w"><h3><a href="http://soft.zdnet.com.cn/">软件</a></h3></li>
<li class="over4w"><h3><a href="http://product.zdnet.com.cn/">桌面产品</a></h3></li>
<li class="over2w"><h3><a href="http://builder.zdnet.com.cn/">开发</a></h3></li>
<li class="over4w"><h3><a href="http://cweek.zdnet.com.cn/">企业管理</a></h3></li>
<li class="over3w"><h3><a href="http://www.itpapers.com.cn/">白皮书</a></h3></li>
<li class="over4w"><h3><a href="http://www.esmb.com.cn/">中小企业</a></h3></li>
<li class="over2w"><h3><a href="http://news.zdnet.com.cn/">新闻</a></h3></li>
<li class="over2w"><h3><a href="http://download.zdnet.com.cn/">下载</a></h3></li>
<li class="over2w nobdg"><h3><a href="http://bbs.zdnet.com.cn/">社区</a></h3></li>
</ul>
<div class="secondnav">
<ul>
<li><a href="http://net.zdnet.com.cn/network_security_zone/intranet.shtml">企业网</a></li>
<li><a href="http://net.zdnet.com.cn/network_security_zone/wireless.shtml">无线网</a></li>
<li><a href="http://net.zdnet.com.cn/network_security_zone/protect.shtml">过滤防护</a></li>
<li><a href="http://net.zdnet.com.cn/network_security_zone/security.shtml">安全管理</a></li>
<li><a href="http://stor-age.zdnet.com.cn/stor-age/network.shtml">网络存储</a></li>
<li><a href="http://stor-age.zdnet.com.cn/stor-age/tape.shtml">磁带库/VTL</a></li>
<li><a href="http://stor-age.zdnet.com.cn/stor-age/protect.shtml">数据保护</a></li>
<li><a href="http://stor-age.zdnet.com.cn/stor-age/odd.shtml">光存储</a></li>
<li><a href="http://server.zdnet.com.cn/server/x86.shtml">X86服务器</a></li>
<li><a href="http://server.zdnet.com.cn/server/vm.shtml">虚拟化</a></li>
<li><a href="http://server.zdnet.com.cn/server/minipc.shtml">小型机</a></li>
<li class="nobod"><a href="http://soft.zdnet.com.cn/software_zone/os.shtml">操作系统</a></li>
</ul>
<ul>
<li><a href="http://soft.zdnet.com.cn/software_zone/db.shtml">数据库</a></li>
<li><a href="http://soft.zdnet.com.cn/software_zone/mw.shtml">中间件</a></li>
<li><a href="http://soft.zdnet.com.cn/software_zone/app.shtml">协作办公</a></li>
<li><a href="http://product.zdnet.com.cn/mobile.shtml">手机</a></li>
<li><a href="http://product.zdnet.com.cn/notebook.shtml">笔记本</a></li>
<li><a href="http://product.zdnet.com.cn/dc.shtml">数码相机</a></li>
<li><a href="http://builder.zdnet.com.cn/code.shtml">C/S开发</a></li>
<li><a href="http://builder.zdnet.com.cn/webdevelop.shtml">web开发</a></li>
<li><a href="http://builder.zdnet.com.cn/epc.shtml">移动开发</a></li>
<li><a href="http://download.zdnet.com.cn/download/list-5-0-0-0-1.htm">web软件</a></li>
<li><a href="http://down.zdnet.com.cn/list.shtml">应用软件</a></li>
<li><a href="http://blog.zdnet.com.cn/">博客</a></li>
<li class="nobod"><a href="http://bbs.zdnet.com.cn/" class="red">论坛</a><img src="%B4%A6%C0%EDHTTPPOSTGET%C7%EB%C7%F3_files/new-101.gif"></li>
</ul>
</div>
</div>
<div class="headsearch" style="height: 22px;">
<form action="" method="get" class="undis">
<label>搜索</label><input name="" class="imsear" type="text"><button type="submit" title="搜索" class="btnbg1">搜索</button><span><a href="#">高级搜索</a></span><label>用户登录</label> 用户名:<input name="" type="text">密码:<input name="" type="text"><button type="submit" title="登录" class="btnbg2">登录</button><span class="coluser"><a href="#">新用户注册</a></span>
</form>
</div>
<div class="fix"></div>
</div>
</div>
<div class="alone">
<div class="lead">
<div class="sonnavall">
<div class="rgnew">
<a href="http://soft.zdnet.com.cn/software_zone/list-0-4-0-0-1.htm">专栏博客</a>|<a href="http://soft.zdnet.com.cn/software_zone/list-0-6-0-0-1.htm">技术看板</a>|<a href="http://soft.zdnet.com.cn/software_zone/list-0-2-0-0-1.htm">新品快看</a>|<a href="http://soft.zdnet.com.cn/software_zone/list-0-5-0-0-1.htm">技术英雄</a>|<a href="http://soft.zdnet.com.cn/software_zone/list-0-8-0-0-1.htm">图片</a>|<a href="http://soft.zdnet.com.cn/software_zone/list-0-9-0-1-1.htm">资讯</a>|<a href="http://soft.zdnet.com.cn/software_zone/list-0-0-0-0-1.htm">最新</a><a href="http://soft.zdnet.com.cn/software_zone/search.php?date=200709&subclass=0">9月</a>|<a href="http://soft.zdnet.com.cn/softsitemap.xml">站点图</a>|<a href="http://bbs.zdnet.com.cn/bbssoftware.shtml" class="network_news">软件社区</a>|<a href="http://soft.zdnet.com.cn/i/software_zone/rss/soft.xml" class="colyellow">RSS</a>
</div>
<ul class="sonnav">
<li class="on"><h4><a href="http://soft.zdnet.com.cn/">软件首页</a></h4></li>
<li><h4><a href="http://soft.zdnet.com.cn/software_zone/os.shtml">操作系统</a></h4></li>
<li><h4><a href="http://soft.zdnet.com.cn/software_zone/db.shtml">数据库</a></h4></li>
<li><h4><a href="http://soft.zdnet.com.cn/software_zone/mw.shtml">中间件</a></h4></li>
<li><h4><a href="http://soft.zdnet.com.cn/software_zone/app.shtml">协作办公</a></h4></li>
<li><h4><a href="http://soft.zdnet.com.cn/software_zone/mgt.shtml">管理软件</a></h4></li>
<li><h4><a href="http://soft.zdnet.com.cn/software_zone/internet.shtml">Web应用</a></h4></li>
</ul>
</div>
<div class="fix"></div>
</div><!--/lead-->
</div>
<!--/header-->
<div class="area fst_bg">
<div class="width">
<!--include virtual="/i/software_zone/ads/software_zone_story_leaderboard_new.htm"-->
<div class="zd_left">
<div class="my_potn sec_nn"><h3>站点导航</h3><span><a href="http://soft.zdnet.com.cn/" target="_blank">软件频道首页</a> / <a href="http://soft.zdnet.com.cn/software_zone/db.shtml" target="_blank">数据库</a> / <a href="http://soft.zdnet.com.cn/software_zone/2007/0910/498635.shtml" target="_blank">如何处理HTTP POST/GET请求</a></span></div>
<!--<div class="zd_ad">
<img src="images/ad_grey.gif" class="img_mag" /><br />
<img src="images/zd_ad03.jpg" />
</div>-->
<div class="zd_row"><div class="headbar"><h1 class="headtit">如何处理HTTP POST/GET请求</h1><h3 class="headaur"><a href="http://soft.zdnet.com.cn/" target="_blank">ZDNet 软件频道</a> 更新时间:<cite>2007-09-10</cite>作者:<span>www.jspsky.net.cn</span> 来源:www.jspsky.net.cn</h3><h2 class="headkeyw">本文关键词: <a href="http://soft.zdnet.com.cn/software_zone/list-0-0-73638-1-1.htm" target="_blank">hugetlbfs</a> <a href="http://soft.zdnet.com.cn/software_zone/list-0-0-49933-1-1.htm" target="_blank">PostgreSQL</a> <a href="http://soft.zdnet.com.cn/software_zone/list-0-0-54354-1-1.htm" target="_blank">Postini</a> <a href="http://soft.zdnet.com.cn/software_zone/list-0-0-58571-1-1.htm" target="_blank">HTTP</a> </h2></div><div class="artl_con">
<p> </p>
<p> 在前面已经讲过Servlet通过下面的方法来提供服务:</p>
<p> 实现service方法。 </p>
<p> 实现HttpServlet的doMethod方法(doGet、doDelete、doOptions、 doPost、doPut、doTrace)。</p>
<p> 通常,service方法用来从客户请求(request)中提取信息,访问扩展资源,并基于上面的信息提供响应(response)。 </p>
<p> 对于HTTP
Servlets,正确提供响应的过程是首先填写响应(response)的头信息,然后从响应(response)中得到输出流,最后向输出流中写入内
容信息。响应(response)头信息必须最先设置。下面将描述如何从请求(request)中获得信息和产生HTTP响应(response)。 </p>
<p> 取得客户端请求 </p>
<p> 一个HttpServletRequest对象提供到达HTTP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -