注册 登录
编程论坛 J2EE论坛

换行问题

shuiyuan0929 发布于 2006-03-28 14:34, 512 次点击
我有一段很长的文本内容,需要显示在textarea文本框中,怎么显示出来的都在一行里没有换行,我明明按了回车,怎么搞的啊?请大师们指点以下
4 回复
#2
〃雙掱ぴ搋兜づ2006-03-28 14:59
<pre>内容</pre>
#3
shuiyuan09292006-03-28 16:39

不行啊显示出来是空格,我在javabean里加了个
public String GetContent(String content)
{
String postCon=content;
int i;
while(postCon.indexOf("<BR>")>0)
{
i=postCon.indexOf("<BR>");
if(i>0) postCon=postCon.substring(0,i)+"\r\n"+postCon.substring(i+4);
}
return postCon;
}
// "\r\n"---><BR>
public String ShowContent(String content)
{
String postCon=content;
int i;
while(postCon.indexOf("\r\n")>0)
{
i=postCon.indexOf("\r\n");
if(i>0) postCon=postCon.substring(0,i)+"<BR>"+postCon.substring(i+2);
}
return postCon;
}
在jsp中怎么调用啊

#4
piaoxue2006-03-28 18:06
info=replace(info,chr(13),"<br>") '替换回车
info=replace(info," ","&nbsp;&nbsp;") '替换空格
这样可以不/?
#5
shuiyuan09292006-03-29 11:29

问题解决了谢谢大家

1