???
你的前台是什么?
如果你的前台是浏览器之类,HTML代码是不会显示在浏览器上的,这个你不会不知道吧?

解决方案 »

  1.   

    做一个过滤类,用来处理内容,把内容的Html代码全部替换掉。
      

  2.   

    不会写这个类,有例子吗
    简单的想是不是将<>符号里边字符过滤掉?
      

  3.   

    用Allreplace这个函数来替换就行了..
      

  4.   

    ===========================================================================
    截取内容中部分字符,同时它也会连同html代码一并输出
    我只要内容中文字(例如汉字或英文字母)===========================================================================
      public static String stringLength(String str ,int length) {
        int lengthCount  = str.length();
        int strLength = str.length();
        int m_length = length;
        try {
          for (int i = 0; i < lengthCount; i++) {
            char c = str.charAt(i);
            if (c >= 256) {
              length++;
              strLength++;
            }
          }
          if (strLength > length) {
            str = str.substring(0, m_length) + "...";
          }
        } catch(Exception e) {
          
        }
        return str;
      }}