TIL

Spring Legacy Project ) ํ”„๋กœ์ ํŠธ ํ™˜๊ฒฝ ์„ค์ • ํ•ด์ฃผ๊ธฐ

jjingle 2022. 1. 12. 22:53

์Šคํ”„๋ง ๋ ˆ๊ฑฐ์‹œ ํ”„๋กœ์ ํŠธ๋ฅผ ์ƒˆ๋กœ ๋งŒ๋“ค๊ณ  ๋‚˜์„œ ๋ณ€๊ฒฝํ•ด์ค˜์•ผ ํ•  ์„ค์ •๋“ค์„ ์ •๋ฆฌํ•ด๋ณด๋ คํ•œ๋‹ค.

ํ•˜์œ„๋‚ด์šฉ์œผ๋กœ ์„ธ ํŒŒ์ผ์„ ์ˆ˜์ •ํ•ด์ฃผ๋ฉด ๋œ๋‹ค.

 

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๋ถ€๋ถ„๋งŒ ๋‚จ๊ฒจ์ค€๋‹ค.


์ด๋ ‡๊ฒŒ ์„ธ ํŒŒ์ผ์„ ์ˆ˜์ •ํ•ด์ฃผ๋ฉด, ๋ชจ๋“  ํ™˜๊ฒฝ์„ค์ • ๋!

์ž, ๊ทธ๋Ÿผ ์ด ์ˆ˜์ •์‚ฌํ•ญ์„ ํ”„๋กœ์ ํŠธ๋ฅผ ๋งŒ๋“ค์–ด์ค„๋•Œ๋งˆ๋‹ค ํ•ด์ค˜์•ผํ•˜๋‚˜?

 -> ๊ทธ๋ ‡๋‹ค..!

 -> ํ•˜์ง€๋งŒ ์ด ๊ณผ์ •์„ ์‰ฝ๊ฒŒํ•˜๊ธฐ ์œ„ํ•ด, ํ…œํ”Œ๋ฆฟ์„ ๋งŒ๋“ค์–ด๋‘๊ณ  ๋งค๋ฒˆ ๋ณต๋ถ™ํ•ด์ฃผ๋ฉด ์ผ์ด ์‰ฌ์›Œ์ง„๋‹ค~

 

 

๊ทธ๋Ÿผ..์ •๋ง์ •๋ง ๋!