2006-12-13
(特殊字符)怎么处理 类似 '<' 到 '<'
我用得是在线编辑器.
现在 当我从数据库中把
<img height="409" alt="" width="300" src="/dzml/UserFiles/Image/img.gif" />
去回到action中是还是上面得这个值..
但是到了页面用<c:out value="${}"/>得时候就成了:
<img height="409" alt="" width="300" src="/dzml/UserFiles/Image/img.gif" />
返回到在线编辑器中得时候还好..我做了js处理
这样还可以在编辑器中显示 正确得内容....
问题是:当是预览得时候:
直接显示得
<img height="409" alt="" width="300" src="/dzml/UserFiles/Image/img.gif"/>
这样得代码
html又是:
<img height="409" alt="" width="300" src="/dzml/UserFiles/Image/img.gif" />
这样得代码了...用上面得方法不管用...
谁有什么办法么???我头都想得疼
现在 当我从数据库中把
<img height="409" alt="" width="300" src="/dzml/UserFiles/Image/img.gif" />
去回到action中是还是上面得这个值..
但是到了页面用<c:out value="${}"/>得时候就成了:
<img height="409" alt="" width="300" src="/dzml/UserFiles/Image/img.gif" />
返回到在线编辑器中得时候还好..我做了js处理
function replaceAll(src, oldStr, newStr){
return src.replace(new RegExp(oldStr, "g"), newStr);
}
function XMLEncode(str){
str=replaceAll(str,"&","&");
str=replaceAll(str,"<","<");
str=replaceAll(str,">",">");
strreplaceAll(str,"'","'");
str=replaceAll(str,"\"",""");
return str;
}
function HtmlEncode(str){
str=replaceAll(str,"&","&");
str=replaceAll(str,"<","<");
str=replaceAll(str,">",">");
str=replaceAll(str,"'","'");
str=replaceAll(str,""","\"");
str=replaceAll(str,""","\"");
return str;
}
这样还可以在编辑器中显示 正确得内容....
问题是:当是预览得时候:
直接显示得
<img height="409" alt="" width="300" src="/dzml/UserFiles/Image/img.gif"/>
这样得代码
html又是:
<img height="409" alt="" width="300" src="/dzml/UserFiles/Image/img.gif" />
这样得代码了...用上面得方法不管用...
谁有什么办法么???我头都想得疼
评论
zhkchi
2006-12-14
谢谢各位得回答..看来偶水平还很菜
SteveGY
2006-12-13
什么啊?好像没看懂lz的意思,但<c:out value="${}" escapeXml="true|false"/>,这个escapeXml可以在false的时候不做xml字符的换意输出,缺省的值是true,也就是不写这个属性,<c:out>的行为就是换意的。可以参考jstl-1_1-mr2-spec.pdf,在jsr上download到。
还有你写的3个函数,不用了,直接使用apache commons StringEscapeUtils的静态方法就可以了,到apache commons去看看。
还有你写的3个函数,不用了,直接使用apache commons StringEscapeUtils的静态方法就可以了,到apache commons去看看。
zhkchi
2006-12-13
好了...
不知道为什么jstl标签c不行
我直接用request.getAttribute就可以了...汗啊!!!去研究一下为啥
不知道为什么jstl标签c不行
我直接用request.getAttribute就可以了...汗啊!!!去研究一下为啥
zhkchi
2006-12-13
我就是用得这个啊..
together
2006-12-13
推荐使用 fckeditor。它会自动替你做这些转换的,非常方便。
本论坛使用的就是它。
本论坛使用的就是它。
zhkchi
2006-12-13
那些字符都没显示出来
就是 < > "" 这些字符
就是 < > "" 这些字符
- 浏览: 13486 次
- 性别:

- 来自: 江苏

- 详细资料
搜索本博客
我的相册
100_0721
共 1 张
共 1 张
最近加入圈子
链接
最新评论
-
hibernate 随记二(一对多 ...
这样做肯定没得问题,用query.createQuery()方法做也没有问题 返 ...
-- by javaman1982 -
hibernate 随记二(一对多 ...
[color=red][/color]
-- by HH -
(特殊字符)怎么处理 类 ...
谢谢各位得回答..看来偶水平还很菜
-- by zhkchi -
(特殊字符)怎么处理 类 ...
什么啊?好像没看懂lz的意思,但<c:out value="${}" es ...
-- by SteveGY -
(特殊字符)怎么处理 类 ...
好了... 不知道为什么jstl标签c不行 我直接用request.getA ...
-- by zhkchi






评论排行榜