从textarea中获得的 文本 要
经过这样处理之后 存储
才可以确保读出数据 可以保持 原有格式?
比如 分行显示
经过这样处理之后 存储
才可以确保读出数据 可以保持 原有格式?
比如 分行显示
解决方案 »
- 严重: Error filterStart+严重: Context startup failed due to previous errors
- 这个错误是什么原因造成的
- servlet中post问题
- Access 随机读取记录?
- request.getscheme()
- 得到HttpServletResponse的内容
- 哪位大虾能说说lucene全文检索的开发,有例子最好,车东的文章没看明白。
- 晕了,怎么会有这种问题,我把代码都改了,可页面还是保留原来的不变?各位有没遇到过啊??在线!!!!!!!!
- 请高手给我看看,applet向servlet发送对象时,在servlet中老是NULL!(在线等待)
- 这行代码什么意思?action在哪里?
- /^\[ \t]*$/ 为什么是匹配一个空白行,看不懂,麻烦大虾们讲解一下
- 关于国际转换时出错
public class CodeFilter{
public CodeFilter(){
}
//特殊字符转为Html
public static String toHtml(String s){
if(s == null){
s = "";
return s;
}
s = Replace(s.trim(),"&","&");
s = Replace(s.trim(),"<","<");
s = Replace(s.trim(),">",">");
s = Replace(s.trim(),"\t"," ");
s = Replace(s.trim(),"\r\n","\n");
s = Replace(s.trim(),"\n","<br>");
s = Replace(s.trim()," "," ");
s = Replace(s.trim(),"'","'");
s = Replace(s.trim(),"\\","\");
return s;
}
//逆
public static String unHtml(String s){
s = Replace(s,"<br>","\n");
s = Replace(s," "," ");
return s;
}
public static String filString(int c,String s){
String a = s.substring(0,c);
return a;
}
public static String strByteCopy(String str,int nEnd)
{
if(nEnd==0)
return "";
byte[] byteStr=str.getBytes();
int k=byteStr.length;
String strSub=new String(byteStr,0,nEnd<k?nEnd:k);
if (strSub.length()==0) strSub=new String(byteStr,0,nEnd-1);
if (nEnd<k) strSub = strSub + "..";
return strSub;
}
}