freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

基于java的web應(yīng)用開發(fā)實訓教程-資料下載頁

2025-06-24 15:45本頁面
  

【正文】 ttpServletRequest reqest,HttpServletResponse response)throws IOException { (text/html。charset=GB2312)。//設(shè)置響應(yīng)的MIME類型 PrintWriter out=()。//獲得一個向客戶發(fā)送數(shù)據(jù)的輸出流 (htmlbody)。 (h2北京奧運圓滿成功!/h2)。 (/body/html)。 } }: servlet servletnamehello/servletname servletclass/servletclass /servlet servletmapping servletnamehello/servletname urlpattern/lookHello/urlpattern /servletmapping例題2:字母package 。import .*。import .*。import .*。public class ShowLetter extends HttpServlet{ public void init(ServletConfig config) throws ServletException { (config)。 } public void service(HttpServletRequest request,HttpServletResponse response) throws IOException { (text/html。charset=GB2312)。 PrintWriter out=()。 (htmlbody)。 (BR小寫希臘字母: )。 for(char c=39。α39。c=39。ω39。c++) { ( +c)。 } (BR大寫希臘字母: )。 for(char c=39。Α39。c=39。Ω39。c++) { ( +c)。 } (/body/html)。 } }welefilelist welefile/welefile /welefilelist servlet servletnamehello/servletname servletclass/servletclass /servlet servletmapping servletnamehello/servletname urlpattern/helpMeShow/urlpattern /servletmapping:Font size=3 單擊超鏈接查看希臘字母表: BRA href=helpMeShow查看希臘字母表/A/Font例題3 package 。import .*。import .*。import .*。public class ComputerPI extends HttpServlet{ double sum=0,i=1,j=1。 int number=0。 public void init(ServletConfig config) throws ServletException {(config)。 } public synchronized void service(HttpServletRequest request,HttpServletResponse response) throws IOException { (text/html。charset=GB2312)。 PrintWriter out=()。 (htmlbody)。 number++。 sum=sum+i/j。 //PI=4*(11/3+1/51/7+….) j=j+2。 i=i。 (servlet:+getServletName()+已經(jīng)被請求了+number+次)。 (BR現(xiàn)在PI的值是:)。 (4*sum)。 (/body/html)。 } }welefilelist welefile/welefile /welefilelist servlet servletnamehello/servletname servletclass/servletclass /servlet servletmapping servletnamehello/servletname urlpattern/getResult/urlpattern/servletmappingFORM action=getResult method=post BR輸入圓的半徑:Input Type=text name=radius Input Type=submit value=提交例題4!DOCTYPE HTML PUBLIC //W3C//DTD HTML Transitional//ENhtml head title/title meta equiv=keywords content=keyword1,keyword2,keyword3 meta equiv=description content=this is my page meta equiv=contenttype content=text/html。 charset=UTF8 !link rel=stylesheet type=text/css href=./ /head body h1 align=center please input your contact information:/h1 form action=/sxd1/servlet/CustomerInfo your name:input type=text name=Namebr your eamil:input type=text name=Emailbr your phone number:input type=text name=Telbr input type=submit value=Submit /body/htmlimport 。import 。import 。import 。import 。import 。public class CustomerInfo extends HttpServlet {public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { (text/html)。 PrintWriter out=()。 (htmlheadtitleCheck information/title+ /headbodybr+ please check your information:hr+ your name is + (Name)+ your is + (Email)+ your phone number is + (Tel)+ /body/html)。 ()。 ()。 }servletnameCustomerInfo/servletname servletclassCustomerInfo/servletclass /servlet servletmapping servletnameCustomerInfo/servletname urlpattern/servlet/CustomerInfo/urlpattern /servletmapping獲取參數(shù)示例:Public class SerarchServlet extends HttpServlet{ Public void doPost( HttpServletRequest req, HttpServletResponse res) throws ServletExcetption,IOException{ ….. Enumeration enum=( )。 While(() ){ String name=(String) ()。 String value=(name)。 } }}83Servlet處理HTTP請求頭9 請求頭從HTTP請求頭中獲取瀏覽器發(fā)送給服務(wù)器的HTTP信息;請求頭是直接由瀏覽器設(shè)置,并在HTTP請求消息中直接發(fā)送。GET /servlet/Search?keyword=bmw HTTP Accept: image/gif ,image/jpg. */*AcceptEncoding :gzipConnection:KeepAliveCookie:userID=user12345Host:Referer:UserAgent:Mozillz/[en](Win98。U)2. Servlet讀取請求頭HttpServletRequest封裝了HTTP請求信息HttpServletRequest類定義了從請求對象中抽取信息的一系列方法;getHeader(“AcceptLanguage”)3. 訪問請求頭的特殊方法getCookies( ) : 返回Cookie頭的內(nèi)容,解析后存放在Cookie對象的數(shù)組中。getContentType( ), getContentLength()getHeaderName()getHeaders( )getMethod( ) :返回GET, POSTgetRequestURI( ) 返回URL主機和端口號后表單數(shù)據(jù)之前的部分URL , getRequestURI( )返回/servlet/SearchgetProtocol( )4. 獲取HTTP請求頭示例一段HTTP請求信息POST /Music/SearchServlet HTTP/Referer:Connetion :KeepAliveUserAgent:Mozila/ [en](winNT 。U)Host:localhost:8080Accept:image/gif,image/xxbitmap,image/jpeg.*/*AcceptLanguage:enAcceptCharset:iso88591,*,utf8Contentlength:50Song_title=helloamp。song_artist=Jonesamp。limit_number=20獲取HTTP請求頭示例Public void SearchServlet(HttpServletRequest request,HttpServletResponse response){….String method=()。If((“GET”){….}String lang=(“AcceptLanguage”)。}HTTP響應(yīng)HttpServletResponse封裝了動態(tài)產(chǎn)生的相應(yīng)Servlet通過 HttpServletResponse把所有的響應(yīng)消息傳遞給客戶設(shè)置ContentType,狀態(tài)碼設(shè)置響應(yīng)頭(cookie,caching)響應(yīng)對象還可以是指向另一個URL的重定向HttpServletResponse的方法HTTP響應(yīng)信息HTTP / 200 OKContentType:text/plainHello WorldSetHeader方法設(shè)置響應(yīng)頭(“Accept”,”image/png”)。WEB服務(wù)器響應(yīng)瀏覽器或其他客戶程序的請求時,其響應(yīng)消息一般由以下及格部分組成:一個狀態(tài)行,幾個響應(yīng)頭,一個空行,和返回的內(nèi)容文檔。HttpServletResponse的方法setContentType()setContentLength( )addCookie( )100199 表示初始的請求已經(jīng)接受,客戶應(yīng)當繼續(xù)發(fā)送請求的其余部分200~299 表示響應(yīng)成功300~399 表示重定向400~499 表示客戶端錯誤500~599 表示服務(wù)器端錯誤HttpServletResponse設(shè)置
點擊復制文檔內(nèi)容
化學相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1