0 0

textarea标签显示html内容,会把后面的代码也当做内容放在 textarea里面3

在jsp页面使用表单,然后用到 textarea标签
如:
<form id="specialeditform" name="form1" action="" method="post" >
<input type="hidden" id="id" name="id" value="${id }" />
<textarea name="content" id="content" rows="15" cols="105" >
      <c:if test="${fn:length(content)>0}">
       ${content}
        </c:if> 
       </textarea> 
 </br>创建人${creator }
 </br>更新人${updator}
<input type="submit" name="" class="sub12" value="提交" />

输人textarea 的内容为html页面源代码:如:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>测试</head>
<body>ceshiceshi </body></html>


保存之后,再回到这个页面想要修改的话,</textarea> 极其后面的代码都在文本域中,提交按钮就不能在页面显示了,
也就不能用了,在火狐和谷歌中可以,我在网上查了下说是IE的不能自动识别textarea标签结束,自动关闭了,请问谁可以
帮忙解决一下,我是解决不了了,谢谢!
2011年12月16日 15:41

2个答案 按时间排序 按投票排序

0 0

或者用div把不想显示的隐藏掉啊!

2011年12月16日 16:42
0 0

<form id="specialeditform" name="form1" action="" method="post" >
<input type="hidden" id="id" name="id" value="${id }" />
<textarea name="content" id="content" rows="15" cols="105" >
      <c:if test="${fn:length(content)>0}">
      <c:out value="${content}" escapeXml="true">
        </c:if> 
       </textarea> 
 </br>创建人${creator }
 </br>更新人${updator}
<input type="submit" name="" class="sub12" value="提交" />


这样试试
escapeXml :是否转换特殊字符,如:< 转换成 &lt;

2011年12月16日 16:03

相关推荐

Global site tag (gtag.js) - Google Analytics