0514-86177077
9:00-17:00(工作日)
JSP中out對象的實例詳解
一 什么是緩沖區(qū)
緩沖區(qū):Buffer,所謂緩沖區(qū)就是內(nèi)存的一塊區(qū)域用來保存臨時數(shù)據(jù)。
二 out對象
out對象是JspWrite類的實例,是向瀏覽器輸出內(nèi)容常用的對象。
三 常用方法
四 實例
%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8"%> % String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> html> head> base href="%=basePath%>" rel="external nofollow" > title>My JSP 'index.jsp' starting page/title> meta http-equiv="pragma" content="no-cache"> meta http-equiv="cache-control" content="no-cache"> meta http-equiv="expires" content="0"> meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> meta http-equiv="description" content="This is my page"> !-- link rel="stylesheet" type="text/css" href="styles.css" rel="external nofollow" > --> /head> body> h1>out內(nèi)置對象/h1> % out.println("h2>靜夜思/h2>"); out.println("床前明月光br>"); out.println("疑是地上霜br>"); out.flush(); //out.clear();//這里會拋出異常。 out.clearBuffer();//這里不會拋出異常。 out.println("舉頭望明月br>"); out.println("低頭思故鄉(xiāng)br>"); %> 緩沖區(qū)大?。?=out.getBufferSize() %>bytebr> 緩沖區(qū)剩余大小:%=out.getRemaining() %>bytebr> 是否自動清空緩沖區(qū):%=out.isAutoFlush() %>BR> /body> /html>
五 運行結(jié)果
如有疑問請留言或者到本站社區(qū)交流討論,感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
標(biāo)簽:貸款邀約 南京 黃石 廣州 內(nèi)江 大連 樂山 銅川
上一篇:JSP開發(fā)之hibernate之單向多對一關(guān)聯(lián)的實例
下一篇:JSP生成九九乘法表的簡單實例
Copyright ? 1999-2012 誠信 合法 規(guī)范的巨人網(wǎng)絡(luò)通訊始建于2005年
蘇ICP備15040257號-8