์คํ๋ง ๋ ๊ฑฐ์ ํ๋ก์ ํธ๋ฅผ ์๋ก ๋ง๋ค๊ณ ๋์ ๋ณ๊ฒฝํด์ค์ผ ํ ์ค์ ๋ค์ ์ ๋ฆฌํด๋ณด๋ คํ๋ค.
ํ์๋ด์ฉ์ผ๋ก ์ธ ํ์ผ์ ์์ ํด์ฃผ๋ฉด ๋๋ค.
pom.xml
1. java version
- source
- target
2. org.springframework-version
3. dependency > servlet
4. dependency > jsp
web.xml
<web-app> ํ๊ทธ ๋ด ์์ฑ๊ฐ ์์
home.jsp
์์ธํ ์์๋ณด์~!
pom.xml
1) java version
2)org.springframework-version
์คํ๋ง ๋ ๊ฑฐ์ ํ๋ก์ ํธ๋ฅผ ์ฒ์ ์์ฑํ ๋ ๊ฒฝ๋ก๋ฅผ com.asd.test / ์ด๋ฆ์ springTest ๋ผ๊ณ ์ค์ ํด๋๋ฉด,
์ฒซ๋ฒ์งธ ๋ฐ์ค ์ ๋ถ๋ถ์ ๋ค์ด๊ฐ๋ค.
๋๋ฒ์งธ ๋นจ๊ฐ๋ฐ์ค ํ์ฌ ์๋ฐ11๋ฒ์ ์ ์ฌ์ฉํ๊ณ ์๊ธฐ๋๋ฌธ์, ํด๋น ๋ฒ์ ์ด 1.6์ผ๋ก ๋์ด์๋๊ฑธ 11๋ก ๋ณ๊ฒฝํด์ค.
ํ๋ ์์ํฌ๋ ์ ์์ ๋ถ์์ ํ์ฌ ์ฌ์ฉํ๊ณ ์๋ 4.3.25๋ก ๋ณ๊ฒฝํด์ฃผ์๋ค.
๊ฐ์ํ์ผ์์ ctrl+F ๋ก ๊ธฐ์กด์ ์๋ฐ ๋ฒ์ (1.6)์ ๊ฒ์ํด๋ณด๋ฉด plugIn ๋ถ๋ถ์ source, target๋ 1.6์ผ๋ก ๋์ด์๋๋ฐ,
์ด๊ฒ ์ญ์ ํ์ฌ ์๋ฐ๋ฒ์ (11)์ผ๋ก ๋ณ๊ฒฝํด์ค๋ค.
3) dependency
servlet๊ณผ jsp ๋ ํ์ฌ ์ฌ์ฉํ๊ณ ์๋ ํฐ์บฃ์ ๋ฒ์ ๊ณผ ๋ง์ถฐ์ฃผ๋ฉด๋๋ค.
https://tomcat.apache.org/whichversion.html
Apache Tomcat® - Which Version Do I Want?
Apache Tomcat® is an open source software implementation of a subset of the Jakarta EE (formally Java EE) technologies. Different versions of Apache Tomcat are available for different versions of the specifications. The mapping between the specifications
tomcat.apache.org
ํ์ฌ 8.5 ํฐ์บฃ์ ์ฌ์ฉ์ค์ด๊ธฐ ๋๋ฌธ์ ํด๋น ํฐ์บฃ๊ณผ ๋ง๋ servlet๊ณผ jsp์ ๋ฒ์ ์ ์ํ์น ์ฌ์ดํธ์์ ํ์ธํ ์ ์๋ค.
https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api
๋ค์ด๋ฐ๊ณ ์ถ์ ํด๋น ๋ฒ์ ์ ํด๋ฆญํ , ๋ธ๋ญ๋์ด์๋ ๋ถ๋ถ์ ์ ์ฒด ๋ณต์ฌํด์ ์ฝ๋๋ถ๋ถ์ ๋ถ์ฌ๋ฃ๊ธฐ๋ก ์์ ํด์ฃผ๋ฉด ๋๋ค.
๊ทธ๋ผ ์ผ๋จ pom ์ค์ ์์ ๋!
web.xml
์ด ํ์ผ์์๋ servlet ๋ฒ์ ์ ๋ง์ถฐ์ฃผ๋ฉด ๋๋๋ฐ, 3.1 ๋ฒ์ ์ ์ฌ์ฉํ๊ณ ์๊ธฐ ๋๋ฌธ์
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
</web-app>
์ด ์ฝ๋๋ฅผ ๊ทธ๋๋ก ์๋จ์ web-app ๋ถ๋ถ์ ๋ณ๊ฒฝํด์ค๋ค.
home.jsp
์๋จ์ ์ ์ธ๋ถ๋ถ(์ฌ์ง์์ ๋ธ๋ญ์ก์ ๋ถ๋ถ)์ ์ง์์ฃผ๊ณ html๋ถ๋ถ๋ง ๋จ๊ฒจ์ค๋ค.
์ด๋ ๊ฒ ์ธ ํ์ผ์ ์์ ํด์ฃผ๋ฉด, ๋ชจ๋ ํ๊ฒฝ์ค์ ๋!
์, ๊ทธ๋ผ ์ด ์์ ์ฌํญ์ ํ๋ก์ ํธ๋ฅผ ๋ง๋ค์ด์ค๋๋ง๋ค ํด์ค์ผํ๋?
-> ๊ทธ๋ ๋ค..!
-> ํ์ง๋ง ์ด ๊ณผ์ ์ ์ฝ๊ฒํ๊ธฐ ์ํด, ํ ํ๋ฆฟ์ ๋ง๋ค์ด๋๊ณ ๋งค๋ฒ ๋ณต๋ถํด์ฃผ๋ฉด ์ผ์ด ์ฌ์์ง๋ค~
๊ทธ๋ผ..์ ๋ง์ ๋ง ๋!
'TIL' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
spring ) pathVariable URL ํน์๋ฌธ์ ๋ฐ๊ธฐ (0) | 2022.01.26 |
---|---|
java ํ๊ฒฝ๋ณ์ ์ค์ (mac m1) (0) | 2022.01.12 |
Oracle /SQL /๊ธฐ๋ณธ๊ฐ DEFAULT ์ ๊ฑฐํ๊ธฐ (0) | 2022.01.06 |
String to int / int to String ํ๋ณํ (0) | 2022.01.03 |
Bootstrap ์คํ์ผ ์ฝ๋ ๋ณ๊ฒฝํ๊ธฐ (0) | 2022.01.02 |