在dw设计页面时,从a页面跳转到b页面时,b页面出现乱码,怎麽解决??急急!!

来源:百度知道 编辑:UC知道 时间:2024/07/13 22:32:59
a页面不惠出现乱码,单独浏览b页面也不出现乱码,只有在跳转时,才出现这种情况。。
另外所有页面均设置charset=gb2312,dw也设置成charset=gb2312。

加一个过滤器。基本代码可以参考下面。
package myAddrBook;
import java.io.IOException;
import javax.Servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.UnavailableException;

/**
* @author Administrator
*
* TODO 要更改此生成的类型注释的模板,请转至
* 窗口 - 首选项 - Java - 代码样式 - 代码模板
*/
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 {

// Conditionally select and set the character encod