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

推荐订阅源

罗磊的独立博客
SecWiki News
SecWiki News
酷 壳 – CoolShell
酷 壳 – CoolShell
爱范儿
爱范儿
量子位
M
MIT News - Artificial intelligence
GbyAI
GbyAI
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
TaoSecurity Blog
TaoSecurity Blog
博客园 - 【当耐特】
H
Heimdal Security Blog
腾讯CDC
The Last Watchdog
The Last Watchdog
Security Archives - TechRepublic
Security Archives - TechRepublic
Hacker News: Ask HN
Hacker News: Ask HN
S
Schneier on Security
Microsoft Security Blog
Microsoft Security Blog
WordPress大学
WordPress大学
博客园 - 司徒正美
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
Cybersecurity and Infrastructure Security Agency CISA
S
SegmentFault 最新的问题
大猫的无限游戏
大猫的无限游戏
Application and Cybersecurity Blog
Application and Cybersecurity Blog
F
Full Disclosure
有赞技术团队
有赞技术团队
T
Tailwind CSS Blog
Engineering at Meta
Engineering at Meta
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
Threatpost
月光博客
月光博客
A
Arctic Wolf
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
雷峰网
雷峰网
T
Troy Hunt's Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The Cloudflare Blog
D
DataBreaches.Net
O
OpenAI News
L
LINUX DO - 最新话题
宝玉的分享
宝玉的分享
小众软件
小众软件
V
Vulnerabilities – Threatpost
A
About on SuperTechFans
人人都是产品经理
人人都是产品经理
T
The Exploit Database - CXSecurity.com
Martin Fowler
Martin Fowler
美团技术团队
P
Privacy International News Feed

博客园 - 往事如风

抓取之近似网页过滤 基情四射的两个css样式 Hadoop 2.4.1 登录认证配置小结 Window中调试HBase问题小结 改了改博客界面 Hbase0.98.4/Hadoop2.4.1整合小结【原创】 Hadoop 2.4.1 Map/Reduce小结【原创】 hadoop的dfs工具类一个【原创】 简化 Hadoop 2.4.1 Eclpse 插件编译【原创】 Hadoop 2.4.1 设置问题小结【原创】 spring的自动装配导致quartz出问题【原创】 spring的单例导致webwork文件上传出现问题【原创】 resin版本导致的webwork2.2.4找不到xwork.xml【原创】 Gel备注【原创】 struts的action直接输出中文备注【原创】 - 往事如风 - 博客园 iframe高度处理【原创】 网上流行的flash切换图片之研究【原创】 FreeMarker生成xml的教训【原创】 图解MyEclipse配置struts+hibernate+spring+FreeMarker【原创】
关于用jsp生成xml的问题【原创】 - 往事如风 - 博客园
往事如风 · 2007-01-22 · via 博客园 - 往事如风

  刚看到群里人说jsp生成的xml用ajax取有问题,由于基本不用jsp做显示,所以只有试验了下,随便写了段测试代码,用ie直接看,很正常,ajax取死活不行,代码如下:

<%@ page language="java" contentType="text/xml; charset=UTF-8" import="java.util.*" pageEncoding="UTF-8"%>
<%
    out.println(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
    out.println(
"<root>");
    out.println(
"<node id=\"1\"/>");
    out.println(
"<node id=\"2\"/>");
    out.println(
"</root>");
    out.close();
%>

  很简单的一段代码,输出responseText看了下,正常,奇怪,把responseText用特殊符号夹起来,终于发现前面多了个换行,看看代码,只有pageEncoding后面的%>那可能有点问题,于是把后面的<%提到前面,代码为

<%@ page language="java" contentType="text/xml; charset=UTF-8" import="java.util.*" pageEncoding="UTF-8"%><%
    out.println(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
    out.println(
"<root>");
    out.println(
"<node id=\"1\"/>");
    out.println(
"<node id=\"2\"/>");
    out.println(
"</root>");
    out.close();
%>

再用ajax取一下,终于好了,很有意思的问题,记一下。