转义自己在入库的时候进行转换
换行->\r\n

解决方案 »

  1.   

    http://expert.csdn.net/Expert/topic/1341/1341714.xml?temp=.4591944
      

  2.   

    <%!//可以在jsp页面里直接定义
    public String replace(String parentStr,String ch,String rep) { 
    int i = parentStr.indexOf(ch); 
    StringBuffer sb = new StringBuffer(); 
    if (i == -1) 
    return parentStr; 
    sb.append(parentStr.substring(0,i) + rep); 
    if (i+ch.length() < parentStr.length()) 
    sb.append(replace(parentStr.substring(i+ch.length(),parentStr.length()),ch,rep)); 
    return sb.toString(); 
    }
    %>
    <%//调用
    str=replace(str," ","&nbsp;");
    str=replace(str,"\n","<br/>");
    %>