반응형
인코딩 설정을 해 줍니다.
-
상단에 Window - Preferences로 들어가 줍니다.
Preferences에서 좌측 상단에 enc를 검색하면 목록이 뜹니다.
좌측 메뉴 탭들 모든 항목의 encoding을 UTF-8로 바꿔줍니다.
Content Type - Text에 들어가서 맨 아래 부분을 보면 Default encoding가 있습니다.
이 부분에 타이핑으로 UTF-8을 적어주고 Update해 줍니다.
두 번째 탭에서는 맨 아래 부분에 Other 부분을 눌러 utf-8로 바꿔줍니다.
위와 같이 Encoding 부분을 전부 다 utf-8로 바꿔주면 Encoding은 끝이 납니다.
-
제 스프링 파일은 위와 같이 설정을 다 해도 한글이 깨지는 경우가 있었는데 알고 보니 넘겨주는 인코딩 코드가 없었어서 따로 추가했습니다.
DispatherServlet-servlet.xml에 들어와서 Source에 들어옵니다.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<!-- 어노테이션 사용하기 -->
<!-- <mvc:annotation-driven />-->
<mvc:annotation-driven>
<mvc:message-converters>
<!-- @ResponseBody Content-Type:application/json;charset=UTF-8 -->
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>text/html;charset=UTF-8</value>
</list>
</property>
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
<bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping" />
<context:component-scan base-package="poly.controller" use-default-filters="false">
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
<context:component-scan base-package="poly.service" />
<context:component-scan base-package="poly.persistance.mapper" />
<!-- ViewResolver : 뷰 선택자 -->
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="order" value="1"/>
<property name="viewClass">
<value>org.springframework.web.servlet.view.JstlView</value>
</property>
<!-- 스프링에서 JSP 결과값을 전달할 때 기본이 되는 루트 위치 -->
<property name="prefix">
<value>/WEB-INF/view/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
<property name="contentType">
<value>text/html; charset=UTF-8</value>
</property>
</bean>
<!-- 파일업로드 기능 -->
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"
p:maxUploadSize="104857600" p:maxInMemorySize="104857600" />
</beans>
위 코드를 복사 붙여넣기로 코드 자체를 전부 다 바꿔줘서 해결했습니다.
반응형
'컴퓨터 공부 > Record : no.01 - Ohju Project' 카테고리의 다른 글
Base Setting : N0.6_개발 준비 (0) | 2021.07.14 |
---|---|
Base Setting : No.05_DataBase Setting (0) | 2021.07.13 |
Base Setting : No.04_TomCat Server (0) | 2021.07.12 |
Base Setting : No.02_Build Path Setting (0) | 2021.07.10 |
Base Setting : No.01_Spring File Import (0) | 2021.07.09 |
댓글