文章詳情頁(yè)
JSP中out對(duì)象的實(shí)例詳解
瀏覽:177日期:2022-06-07 11:33:16
JSP中out對(duì)象的實(shí)例詳解
一 什么是緩沖區(qū)
緩沖區(qū):Buffer,所謂緩沖區(qū)就是內(nèi)存的一塊區(qū)域用來(lái)保存臨時(shí)數(shù)據(jù)。
二 out對(duì)象
out對(duì)象是JspWrite類的實(shí)例,是向?yàn)g覽器輸出內(nèi)容常用的對(duì)象。
三 常用方法
四 實(shí)例
<%@ 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)置對(duì)象</h1> <% out.println("<h2>靜夜思</h2>"); out.println("床前明月光<br>"); out.println("疑是地上霜<br>"); out.flush(); //out.clear();//這里會(huì)拋出異常。 out.clearBuffer();//這里不會(huì)拋出異常。 out.println("舉頭望明月<br>"); out.println("低頭思故鄉(xiāng)<br>"); %> 緩沖區(qū)大小:<%=out.getBufferSize() %>byte<br> 緩沖區(qū)剩余大小:<%=out.getRemaining() %>byte<br> 是否自動(dòng)清空緩沖區(qū):<%=out.isAutoFlush() %><BR> </body></html>
五 運(yùn)行結(jié)果
如有疑問(wèn)請(qǐng)留言或者到本站社區(qū)交流討論,感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!
標(biāo)簽:
JSP
相關(guān)文章:
1. jsp+servlet簡(jiǎn)單實(shí)現(xiàn)上傳文件功能(保存目錄改進(jìn))2. jsp cookie+session實(shí)現(xiàn)簡(jiǎn)易自動(dòng)登錄3. JSP靜態(tài)導(dǎo)入與動(dòng)態(tài)導(dǎo)入使用詳解4. 詳解JSP 內(nèi)置對(duì)象request常見(jiàn)用法5. 淺談SpringMVC jsp前臺(tái)獲取參數(shù)的方式 EL表達(dá)式6. Jsp中request的3個(gè)基礎(chǔ)實(shí)踐7. jsp網(wǎng)頁(yè)實(shí)現(xiàn)貪吃蛇小游戲8. 提升JSP應(yīng)用程序的七大絕招9. 基于javaweb+jsp實(shí)現(xiàn)企業(yè)財(cái)務(wù)記賬管理系統(tǒng)10. jsp實(shí)現(xiàn)textarea中的文字保存換行空格存到數(shù)據(jù)庫(kù)的方法
排行榜
