////
Search
๐Ÿฑ

Tomcat ์‚ฌ์šฉํ•˜๊ธฐ

์„ธํŒ…
โ€ข
tomcat 10 ์„ค์น˜
โ€ข
intellij์—์„œ java, maven ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ
โ€ข
github์— ์ƒˆ๋กœ์šด repo๋งŒ๋“ค๊ณ  ์—ฐ๊ฒฐ
โ€ข
.gitignore์ถ”๊ฐ€(intellij์—์„œ ์ง์ ‘ ์ž‘์„ฑํ•˜์ง€ ์•Š์œผ๋ฉด ์ธ์‹์ด ์•ˆ ๋˜๋Š” ์˜ค๋ฅ˜๊ฐ€ ์žˆ์—ˆ์Œ)
โ—ฆ
gitignore.io์—์„œ java, maven, intellij ํ‚ค์›Œ๋“œ๋กœ ์ƒ์„ฑํ•˜์—ฌ ๋ณต๋ถ™ ๋˜๋Š” echo๋กœ ์ƒ์„ฑ
git init git remote add origin https://github.com/sgcs11/tomcat_exam.git echo ".idea" >> .gitignore echo "target" >> .gitignore git add . git commit -m "์„ธํŒ…" git push origin master
Shell
๋ณต์‚ฌ
โ€ข
tomcat 10 ๋ฒ„์ „๋ถ€ํ„ฐ๋Š” ์‚ฌ์šฉ์„ ์œ„ํ•ด์„œ jakarta ๋””ํŽœ๋˜์‹œ ์ถ”๊ฐ€ ํ•„์š”
<dependencies> <dependency> <groupId>jakarta.servlet</groupId> <artifactId>jakarta.servlet-api</artifactId> <version>6.0.0</version> <scope>provided</scope> </dependency> </dependencies>
XML
๋ณต์‚ฌ
โ€ข
src/main์— webapp ํด๋” ์ถ”๊ฐ€
โ—ฆ
index.html ์ž‘์„ฑํ•˜์—ฌ http://localhost:8080์—์„œ ์ž˜ ๋œจ๋Š”์ง€ ํ™•์ธ
โ€ข
src/main/java์—์„œ HelloServlet.java ์ƒ์„ฑํ•˜๊ณ  @WebServlet("/hello")์œผ๋กœ Servlet ์ž‘์„ฑ