IT

sts 웹 프로젝트 생성 후 주요 기본 설정

미르오키드 2021. 9. 23. 17:10
반응형

한글처리관련  (UTF-8 로 설정해줘야 하는 부분)

STS

Window > Preferences > General > Workspace >Text file encoding 

Window > Preferences > Web > CSS Files > Encoding 

Window > Preferences > Web > HTML Files > Encoding 

Window > Preferences > Web > JSP Files > Encoding

 

프로젝트

/WEB-INF/web.xml

filter, filter-mapping 부분 추가

    <filter>
        <filter-name>encodingFilter</filter-name>
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</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>

/WEB-INF/views/home.jsp (모든 jsp 에 적용)

page 부분

<%@ page contentType="text/html;charset=UTF-8"%>

 

java 버전

STS

Properties(프로젝트 마우스 오른쪽 클릭) > Libraries > JRE System Library [{version}]

 

프로젝트

/pom.xml

java-version 부분

<properties>
	<java-version>1.8</java-version>
	<org.springframework-version>5.0.7.RELEASE</org.springframework-version>
	<org.aspectj-version>1.6.10</org.aspectj-version>
	<org.slf4j-version>1.6.6</org.slf4j-version>
</properties>

source, target 부분

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <compilerArgument>-Xlint:all</compilerArgument>
                    <showWarnings>true</showWarnings>
                    <showDeprecation>true</showDeprecation>
                </configuration>
            </plugin>
        </plugins>
    </build>

서블릿 버전

/pom.xml

version 부분

<dependency>
	<groupId>javax.servlet</groupId>
	<artifactId>javax.servlet-api</artifactId>
	<version>4.0.0</version>
	<scope>provided</scope>
</dependency>

/WEB-INF/web.xml

web-app  부분

<web-app version="4.0" xmlns="http://java.sun.com/xml/ns/javaee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee https://java.sun.com/xml/ns/javaee/web-app_4_0.xsd">

 

스프링버전

/pom.xml 

org.springframework-version 부분 

<properties>
	<java-version>1.8</java-version>
	<org.springframework-version>5.0.7.RELEASE</org.springframework-version>
	<org.aspectj-version>1.6.10</org.aspectj-version>
	<org.slf4j-version>1.6.6</org.slf4j-version>
</properties>

 

 

반응형