LINUX.ORG.RU

История изменений

Исправление CYB3R, (текущая версия) :

Да исходников там две строчки должно быть.

public class EncodingFilter implements Filter {
	private String encoding = "UTF-8";

	public void doFilter(ServletRequest request,
	ServletResponse response, FilterChain filterChain) throws IOException, ServletException {
		request.setCharacterEncoding(encoding);
		filterChain.doFilter(request, response);
	}

	public void init(FilterConfig filterConfig) throws ServletException {
		String encodingParam = filterConfig.getInitParameter("encoding");
		if (encodingParam != null) {
			encoding = encodingParam;
		}
	}

	public void destroy() {

	}
}
web.xml:
<filter>
	<filter-name>EncodingFilter</filter-name>
	<filter-class>
		net.einwaller.filters.EncodingFilter
	</filter-class>
	<init-param>
		<param-name>encoding</param-name>
		<param-value>UTF-8</param-value>
	</init-param>
</filter>

<filter-mapping>
	<filter-name>EncodingFilter</filter-name>
	<url-pattern>/*</url-pattern>
</filter-mapping>
Взято отсюда.

Исправление CYB3R, :

Да исходников там две строчки должно быть.

public class EncodingFilter implements Filter {
	private String encoding = "UTF-8";

	public void doFilter(ServletRequest request,
	ServletResponse response, FilterChain filterChain) throws IOException, ServletException {
		request.setCharacterEncoding(encoding);
		filterChain.doFilter(request, response);
	}

	public void init(FilterConfig filterConfig) throws ServletException {
		String encodingParam = filterConfig.getInitParameter("encoding");
		if (encodingParam != null) {
			encoding = encodingParam;
		}
	}

	public void destroy() {

	}
}
web.xml:
<filter>
	<filter-name>EncodingFilter</filter-name>
	<filter-class>
		net.einwaller.filters.EncodingFilter
	</filter-class>
	<init-param>
		<param-name>encoding</param-name>
		<param-value>UTF-8</param-value>
	</init-param>
</filter>

<filter-mapping>
	<filter-name>EncodingFilter</filter-name>
	<url-pattern>/*</url-pattern>
</filter-mapping>

Исходная версия CYB3R, :

Да исходников там две строчки должно быть.

public class EncodingFilter implements Filter {
	private String encoding = "utf-8";

	public void doFilter(ServletRequest request,
	ServletResponse response, FilterChain filterChain) throws IOException, ServletException {
		request.setCharacterEncoding(encoding);
		filterChain.doFilter(request, response);
	}

	public void init(FilterConfig filterConfig) throws ServletException {
		String encodingParam = filterConfig.getInitParameter("encoding");
		if (encodingParam != null) {
			encoding = encodingParam;
		}
	}

	public void destroy() {

	}
}
web.xml:
<filter>
	<filter-name>EncodingFilter</filter-name>
	<filter-class>
		net.einwaller.filters.EncodingFilter
	</filter-class>
	<init-param>
		<param-name>encoding</param-name>
		<param-value>UTF-8</param-value>
	</init-param>
</filter>

<filter-mapping>
	<filter-name>EncodingFilter</filter-name>
	<url-pattern>/*</url-pattern>
</filter-mapping>