乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      IDEA創(chuàng)建Maven項目

       印度阿三17 2021-03-07

      前言

      一些小問題:
      關(guān)于maven無法創(chuàng)建servlet可以點擊查看:《idea 的maven無法創(chuàng)建servlet》


      先創(chuàng)建一個maven工程,流程如下:

      在這里插入圖片描述
      在這里插入圖片描述
      在這里插入圖片描述
      在這里插入圖片描述
      以上maven工程創(chuàng)建完成了。

      Maven使用入門,小案例

      1. 按照以上步驟,創(chuàng)建的maven工程,結(jié)構(gòu)如下:
        在這里插入圖片描述

      2. maven目錄結(jié)構(gòu)里面缺少了Java源文件夾,需要我們手動添加上去,過程如下:

        先新建目錄


        在這里插入圖片描述

      在這里插入圖片描述
      3.再將新建的文件設(shè)置為源文件
      在這里插入圖片描述
      4.在java新建包,再在包里新建一個servlet,關(guān)于maven無法創(chuàng)建servlet,可以參考前言里的解決辦法進(jìn)行相應(yīng)設(shè)置,

      項目的結(jié)構(gòu)如圖:
      在這里插入圖片描述
      servlet代碼如下:

      package aa.bb;
      
      import javax.servlet.ServletException;
      
      import javax.servlet.annotation.WebServlet;
      import javax.servlet.http.HttpServlet;
      import javax.servlet.http.HttpServletRequest;
      import javax.servlet.http.HttpServletResponse;
      import java.io.IOException;
      
      @WebServlet("/testServlet")
      public class TestServlet extends HttpServlet {protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {request.getRequestDispatcher("/test.jsp").forward(request, response);
          }
      
          protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {doPost(request, response);
          }
      }

      jsp代碼如下:

      <%@ page contentType="text/html;charset=UTF-8" language="java" %>
      <html>
      <head>
          <title>Title</title>
      </head>
      <body>
      hello!!!Maven
      </body>
      </html>

      pom.xml配置

      <?xml version="1.0" encoding="UTF-8"?>
      
      <project xmlns="http://maven./POM/4.0.0" xmlns:xsi="http://www./2001/XMLSchema-instance" xsi:schemaLocation="http://maven./POM/4.0.0 http://maven./maven-v4_0_0.xsd">
      
        <modelVersion>4.0.0</modelVersion>
        <packaging>war</packaging>
      
        <name>maven1</name>
        <groupId>org.example</groupId>
        <artifactId>maven1</artifactId>
        <version>1.0-SNAPSHOT</version>
      
        <!--放置的都是項目運(yùn)行所依賴的jar包-->
        <dependencies>
      <!--    <dependency>-->
      <!--      <groupId>javax.servlet</groupId>-->
      <!--      <artifactId>servlet-api</artifactId>-->
      <!--      <version>2.5</version>-->
      <!--      <scope>provided</scope>-->
      <!--    </dependency>-->
          <!--jsp-->
          <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.2</version>
            <scope>provided</scope>
          </dependency>
          <!--junit-->
          <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
          </dependency>
          <!--servlrt-->
          <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>4.0.0</version>
            <scope>provided</scope>
          </dependency>
      
        </dependencies>
      
        <build>
          <plugins>
            <!--配置tomcat-->
            <plugin>
              <groupId>org.apache.tomcat.maven</groupId>
              <artifactId>tomcat7-maven-plugin</artifactId>
              <version>2.2</version>
              <configuration>
                <port>8089</port>
              </configuration>
            </plugin>
            <!--配置jdk-->
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-compiler-plugin</artifactId>
              <configuration>
                <target>1.8</target>
                <source>1.8</source>
                <encoding>UTF-8</encoding>
              </configuration>
            </plugin>
          </plugins>
        </build>
      
      </project>

      在這里插入圖片描述
      運(yùn)行結(jié)果:

      在這里插入圖片描述

      在這里插入圖片描述

      來源:https://www./content-4-882551.html

        本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多