把logic:iterate中的参数escapehtml设为false

解决方案 »

  1.   

    在web.xml文件中加入过滤器filter
      

  2.   

    很明显 中国在标签解析时,&被按照html特殊符号被解析成&了嘛,把标签的这个功能关掉就是了。同时,如果你的jsp页面如果有汉字的话,还需要把jsp文件的编码格式也设置为utf-8。
      

  3.   

    在web.xml文件中加入过滤器filter,但是乱码的问题还是没有解决,但将jsp设置成utf-8后,乱码
    问题到是解决了,但utf-8的输出问题还是没有解决我跟踪了下Struts源码,发现struts的确是将&输出成&amp,
    调用了org.apache.struts.util.ResponseUtils.filter()函数,
    <bean:write 这个标签有关掉的功能,将filter设为false就可以了
    但<html:text 这个标签没有filter的功能,不知道怎么样才可以将标签的这个功能给关掉
      

  4.   

    jsp页面保存到数据库有乱码解决方法Jsp+tomcat+bean中文乱码问题解决方法javabean中参数有乱码
    1) 所有的jsp页面指定字符编码方式,如:Charest=gb2312,Charest=UTF-8等等
    2) 在应用服务器中的server.xml方件中找到设置服务器端口的行,一般是这样开头:”<Connector port="8080"”,
    3) 在找到的行"<Connector"开头的字符串后加上:URIEncoding="UTF-8" ,保存文件
    --------------------------------------------------------------------------
    jsp页面有乱码解决方法    所有的jsp页面指定字符编码方式,如:Charest=gb2312,Charest=UTF-8等等
        <%@ page contentType="text/html; charset=UTF-8">
    --------------------------------------------------------------------------
    jsp单个中文参数乱码解决方法    用这个转换一下: 
        <%!String trans(String chi)
           {
            string result =null;
            byte temp[];
            temp=chi.getBytes("iso=8859-1");
            result= new String(temp);
            }
        %>
    或者直接这样:
        <% 
          request.setCharacterEncoding("UTF-8");
          out.println(request.getParameter("参数ID")
        %>
    --------------------------------------------------------------------------
      

  5.   

    guishuanglin(小桂子) 
    严重支持!
      

  6.   

    过滤器
    package cn.icdi.util;import javax.servlet.*;
    import java.io.IOException;public class SetCharacterEncodingFilter
        implements Filter {  protected String encoding = null;
      protected FilterConfig filterConfig = null;
      protected boolean ignore = true;  public void destroy() {    this.encoding = null;
        this.filterConfig = null;  }  public void doFilter(ServletRequest request, ServletResponse response,
                           FilterChain chain) throws IOException, ServletException {    if (ignore || (request.getCharacterEncoding() == null)) {
          String encoding = selectEncoding(request);
          if (encoding != null) {
            request.setCharacterEncoding(encoding);
          }
        }    chain.doFilter(request, response);  }  public void init(FilterConfig filterConfig) throws ServletException {    this.filterConfig = filterConfig;
        this.encoding = filterConfig.getInitParameter("encoding");
        String value = filterConfig.getInitParameter("ignore");
        if (value == null) {
          this.ignore = true;
        }
        else if (value.equalsIgnoreCase("true")) {
          this.ignore = true;
        }
        else if (value.equalsIgnoreCase("yes")) {
          this.ignore = true;
        }
        else {
          this.ignore = false;
        }  }  protected String selectEncoding(ServletRequest request) {
        return (this.encoding);
      }
    }
    配置不用我说了吧:)
    mysql4的默认字符编码为latin1,可以在web.xml中设置过滤器编码为utf-8,当然如果是tomcat最好也设置成utf-8的编码方式,这样不会出问题。mysql3只要在数据库连接url中设置编码方式就好了