환경
- weblogic 10
- sitemesh 2.4.1
문제
- UTF-8 환경에서 decorator 태그로 호출되는 영역의 한글깨짐 현상
(ex) <decorator:body />
해결책 2가지(택1)
1. 웹로직 자바 실행환경에 옵션 추가 : -Dfile.encoding=utf-8
2. 필터 추가 : web.xml에 적용
- weblogic 10
- sitemesh 2.4.1
문제
- UTF-8 환경에서 decorator 태그로 호출되는 영역의 한글깨짐 현상
(ex) <decorator:body />
해결책 2가지(택1)
1. 웹로직 자바 실행환경에 옵션 추가 : -Dfile.encoding=utf-8
2. 필터 추가 : web.xml에 적용
package com.moneta.mobile.cashbook.web.filter;
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;
public class CharsetEncodingFilter implements Filter {
private String encoding;
protected FilterConfig filterConfig;
public void init(FilterConfig filterConfig) throws ServletException {
this.filterConfig = filterConfig;
this.encoding = filterConfig.getInitParameter("encoding");
}
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
servletRequest.setCharacterEncoding(this.encoding);
servletResponse.setContentType("text/html;charset=" + this.encoding);
filterChain.doFilter(servletRequest, servletResponse);
}
public void destroy() {
this.encoding = null;
this.filterConfig = null;
}
}
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;
public class CharsetEncodingFilter implements Filter {
private String encoding;
protected FilterConfig filterConfig;
public void init(FilterConfig filterConfig) throws ServletException {
this.filterConfig = filterConfig;
this.encoding = filterConfig.getInitParameter("encoding");
}
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
servletRequest.setCharacterEncoding(this.encoding);
servletResponse.setContentType("text/html;charset=" + this.encoding);
filterChain.doFilter(servletRequest, servletResponse);
}
public void destroy() {
this.encoding = null;
this.filterConfig = null;
}
}
'Xml' 카테고리의 다른 글
[Xml] Ant - FTP 파일 업로드 하기 (0) | 2010.12.22 |
---|---|
[Xml] Filter를 사용하여 프로퍼티의 정보 활용 (0) | 2010.12.08 |
[Xml] JDOM 설치와 (JAVA로 XML 문서만들기/추가하기) (0) | 2010.12.07 |
[Xml] 오라클 쿼리로 바로 xml생성 하기 (0) | 2010.12.07 |
[Xml] Web.xml - <load-on-startup>0</load_on-startup> (0) | 2010.09.03 |