# 프로젝트 생성 및 기본설정

## 1. 프로젝트 생성

<figure><img src="/files/RnETUEU2cK2pskH7MjSg" alt=""><figcaption><p>새 프로젝트 선택</p></figcaption></figure>

<figure><img src="/files/RORSR3v29iAwykWscWsR" alt=""><figcaption></figcaption></figure>

프로젝트 이름을 지정하고 프로젝트를 저장할 경로를 선택

템플릿은 웹 애플리케이션으로 지정(web.xml과 index.jsp를 자동으로 생성해준다.)

Tomcat은 기존의 tomcat 서버가 있는 경우 선택하고 아닌경우는 나중에 선택

언어는 java  빌드는 Maven 선택&#x20;

Maven의 경우 pom.xml을 통해 빌드 설정 및 라이브러리 관리

그룹은 보통 관례적으로 회사명.프로젝트명 이런식으로 작성함&#x20;

우리는 실습을 위한 프로젝트이기 때문에com.example로 생성

설정 지정 후 다음 버튼 클릭!

<figure><img src="/files/bVkKifRieqP9NIHXAOrM" alt=""><figcaption></figcaption></figure>

Jakarta EE 10 버전 선택 후&#x20;

Servlet 6.0 버전 확인 후 생성 버튼 클릭

책 27p 톰캣 버전별 JSP   / 서블릿 사양 확인&#x20;

수업은&#x20;

JDK : 17

Tomcat : 10.1&#x20;

Servlet : 6.0&#x20;

기준으로 작성함

pom.xml 확인

pom.xml의 java 버전 17로 변경

pom.xml은 변경 후 항상 로드 필요

<figure><img src="/files/PffYqGgBxZcfYQQGpYOD" alt=""><figcaption></figcaption></figure>

```xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example</groupId>
    <artifactId>example</artifactId>
    <version>1.0-SNAPSHOT</version>
    <name>example</name>
    <packaging>war</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <!--  java 버전 설정 17로 변경-->
        <maven.compiler.target>17</maven.compiler.target>
        <maven.compiler.source>17</maven.compiler.source>
        <junit.version>5.10.0</junit.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
            <version>6.0.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.4.0</version>
            </plugin>
        </plugins>
    </build>
</project>
```

<figure><img src="/files/YxdNJcftmufKO27ozdJe" alt=""><figcaption></figcaption></figure>

HelloServlet.java 클래스 파일 삭제

### 프로젝트 구조 확인

### <mark style="color:orange;">아래의 과정은 패싯과 아티팩트가 없는경우에만 진행함</mark>&#x20;

### <mark style="color:orange;">정상적으로 인식한경우에는 2.Tomcat 설정으로 넘어가면 됩니다.</mark>

단축키 :    Ctrl + Alt + Shift + L&#x20;

보통 프로젝트 생성 후 IDE가 자동으로 인식하지만 인식 못하는 경우가 발생함

<figure><img src="/files/NCaPMzRZnwEJ0u0EQuG8" alt=""><figcaption></figcaption></figure>

### 1)패싯 확인

패싯이 없는 경우 + 버튼 클릭 후 Web 선택

<figure><img src="/files/u2p18ZsEXwdC50iYYfdx" alt=""><figcaption></figcaption></figure>

프로젝트 내의 web.xml의 경로와 웹 모듈 배포설명자의 경로가 일치하는 지 확인&#x20;

### 2)아티팩트 확인

<figure><img src="/files/Wo6RBDFsrihZqty7F9vF" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/v0JUpwQYclbw5nnvu8f3" alt=""><figcaption></figcaption></figure>

이렇게 하면 패싯과 아티팩트 설정 완료

## 2. Tomcat 다운로드 및 설정

{% embed url="<https://tomcat.apache.org/download-10.cgi>" %}

<figure><img src="/files/0yRMgd3vycDSzfA2thg0" alt=""><figcaption></figcaption></figure>

위 링크에 접속해 tomcat 10.1 버전 zip 파일 다운로드&#x20;

작업폴더에 tool 폴더 생성 후 tomcat 파일압축 해제&#x20;

인텔리제이 우측상단 클릭 후 구성편집 선택

<figure><img src="/files/Y9b3p0LGqCwiaNS9EI2v" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/qhQL22RHmSg88hLQDlYj" alt=""><figcaption></figcaption></figure>

\+ 버튼 클릭 후 Tomcat 서버 - 로컬 선택

<figure><img src="/files/fjkjMv5p0CSx6KlJ0eL7" alt=""><figcaption></figcaption></figure>

구성 버튼 클릭&#x20;

<figure><img src="/files/muSe82cNZBKK30hOALyO" alt=""><figcaption></figcaption></figure>

애플리케이션 서버 창에서 + 버튼 클릭 후 Tomcat 홈 디렉토리 지정&#x20;

<figure><img src="/files/iRqAjGS42IiBRXLfB2KN" alt=""><figcaption></figcaption></figure>

압축 해제한 경로의 톰캣 디렉토리를 선택 후 확인 버튼 클릭

<figure><img src="/files/OcYrhIgjDOgPxDtfq7P8" alt=""><figcaption></figcaption></figure>

정상 등록되었는지 확인 후 확인 버튼 클릭&#x20;

<figure><img src="/files/dPHtFU3GVrMxgkD2hIbW" alt=""><figcaption></figcaption></figure>

배포 탭에서 +버튼 클릭 후 아티팩트 선택

<figure><img src="/files/figHdanQLM3EtqVraXE5" alt=""><figcaption></figcaption></figure>

애플리케이션 컨택스트를 / 로 수정 후 확인

## 3. 프로젝트 실행

&#x20;프로젝트 실행 버튼 클릭 (Shifth + F10)&#x20;

<figure><img src="/files/rMHhWoSYHt5hdt6IWNLE" alt=""><figcaption></figcaption></figure>

이후 index.jsp의 내용이 잘 출력되는지 확인&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://leeans-dev-book.gitbook.io/docs/lecture/jsp/undefined.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
