惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Proofpoint News Feed
博客园 - 聂微东
Application and Cybersecurity Blog
Application and Cybersecurity Blog
MyScale Blog
MyScale Blog
罗磊的独立博客
H
Help Net Security
L
LangChain Blog
T
Threat Research - Cisco Blogs
量子位
S
Securelist
Last Week in AI
Last Week in AI
L
Lohrmann on Cybersecurity
T
The Exploit Database - CXSecurity.com
P
Privacy International News Feed
The Hacker News
The Hacker News
Vercel News
Vercel News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
Cybersecurity and Infrastructure Security Agency CISA
T
The Blog of Author Tim Ferriss
T
Threatpost
Security Latest
Security Latest
P
Palo Alto Networks Blog
Microsoft Security Blog
Microsoft Security Blog
NISL@THU
NISL@THU
F
Full Disclosure
WordPress大学
WordPress大学
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Stack Overflow Blog
Stack Overflow Blog
C
Check Point Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
酷 壳 – CoolShell
酷 壳 – CoolShell
H
Heimdal Security Blog
J
Java Code Geeks
Recorded Future
Recorded Future
Hugging Face - Blog
Hugging Face - Blog
G
GRAHAM CLULEY
Know Your Adversary
Know Your Adversary
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
阮一峰的网络日志
阮一峰的网络日志
U
Unit 42
B
Blog RSS Feed
月光博客
月光博客
C
Cisco Blogs
V
Visual Studio Blog
D
DataBreaches.Net
H
Hacker News: Front Page
博客园 - 叶小钗
N
News and Events Feed by Topic
爱范儿
爱范儿
A
Arctic Wolf

博客园 - 雨叶秋寒

sjCatSoft上传组件 - 雨叶秋寒 - 博客园 JavaScript判断上传文件类型 - 雨叶秋寒 - 博客园 MSSQL的“未与信任SQL SERVER相关联”错误 JAVA中数据类型的转换 在JavaBean中存放数据 - 雨叶秋寒 - 博客园 JSP中out对象的方法总结 JSP中的两种包含页面的方法 - 雨叶秋寒 - 博客园 控制TextBox的ReadOnly属性 - 雨叶秋寒 - 博客园 用计划任务定时执行ASP文件 - 雨叶秋寒 - 博客园 读邹建的书(第二章) ASP备份MSSQL数据库 利用ADOX更改字段名 ADOX使用范例(调试成功) ADOX 对象总结 调用类 调用存储过程 MSDN给出的Hashtable的示例 Snippet Compiler 对ArrayList 的简单研究
JSP中的缓冲区你到底能用多少? - 雨叶秋寒 - 博客园
雨叶秋寒 · 2005-09-22 · via 博客园 - 雨叶秋寒

看下面这段程序,首先设置buffer="1kb" autoFlush="false",然后向页面中输出970个“C” 。

<%@ page language="java" buffer="1kb" autoFlush="false" %>
<html>
<head></head>
<body>
<%
  
for(int i=0; i<970;i++)
    out.print(
"C");
%>
</body>
</html>

执行一下,成功!
然后我们试这把970改为971,也就是让多输出一个“C”,执行后结果提示错误:JSP Buffer overflow ,这个都看得明白吧。好,下面我们试试将buffer设置为2kb的结果:

<%@ page language="java" buffer="2kb" autoFlush="false" %>
<html>
<head></head>
<body>
<%
  
for(int i=0; i<1994;i++)
    out.print(
"C");
%>
</body>
</html>

执行一下,成功!
然后把这1994改为1995,执行后又是缓冲区溢出。好了,问题就在这里了,下面来做个猜测(之所以说是猜测不说是结论,是因为才刚接触2天的JSP,有很多东西还不了解,不能枉下结论):
我们来看看970和1994吧(原以为缓冲区大小改为2K后最多输出的字符会是970×2 = 1460),我们来看看这个,1994-970是多少?1024,这就对了,说明我们每次执行一个页面时,除了我们用到的,系统还占用了固定的一部分的缓冲区(因为不清楚到底是哪占用了,所以用系统代而言之,委屈你一下了^_^),这个大小就是1024-970 = 54Byte,为了证实一下这个言论我们再做个实验——3K(汗~~总是这么点..因为雨叶的机子差嘛.^_^!):

1994+1024应该是3018,我们运行下面的一段程序:

<%@ page language="java" buffer="3kb" autoFlush="false" %>
<html>
<head></head>
<body>
<%
  
for(int i=0; i<3018;i++)
    out.print(
"C");
%>
</body>
</html>

执行一下,成功!

然后改为3019,执行——意料之中的错误。只是不知道这块被占用的区域拿去做什么了..郁闷..

因为刚刚接触JSP2天,如有不对之处请不吝赐教,以免误人子弟!