diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..e7e9d11d4bf243bffe4bb60b4ac1f9392297f4bf --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,2 @@ +# Default ignored files +/workspace.xml diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000000000000000000000000000000000000..28a804d8932aba40f168fd757a74cb718a955a1a --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000000000000000000000000000000000000..8e9987035052f276318390db9534dbdd425b2905 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000000000000000000000000000000000000..35eb1ddfbbc029bcab630581847471d7f238ec53 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/web-framework.iml b/.idea/web-framework.iml new file mode 100644 index 0000000000000000000000000000000000000000..d6ebd4805981b8400db3e3291c74a743fef9a824 --- /dev/null +++ b/.idea/web-framework.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/README.en.md b/README.en.md deleted file mode 100644 index bd2cb730acb8953f053bb4efffb6c69acc969952..0000000000000000000000000000000000000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# 软件开发与管理 - -#### Description -{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**} - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..05ee2430c8ca6bc2465e76192fc16462bb0d7c46 --- /dev/null +++ b/pom.xml @@ -0,0 +1,63 @@ + + + 4.0.0 + + UTF-8 + + + org.example + project1 + 1.0-SNAPSHOT + + + + junit + junit + 4.12 + test + + + javax.servlet + javax.servlet-api + 3.1.0 + provided + + + war + + + + + + org.apache.maven.plugins + maven-war-plugin + 3.3.2 + + + + + src/main/webapp + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.3.2 + + private + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/example/Calculator.java b/src/main/java/com/example/Calculator.java new file mode 100644 index 0000000000000000000000000000000000000000..708e34314562aca927708762ae55ab28ed8cf740 --- /dev/null +++ b/src/main/java/com/example/Calculator.java @@ -0,0 +1,11 @@ +package com.example; + +public class Calculator { + public int add(int a, int b) { + return a + b; + } + + public int subtract(int a, int b) { + return a - b; + } +} diff --git a/src/main/java/com/example/HelloServlet.java b/src/main/java/com/example/HelloServlet.java new file mode 100644 index 0000000000000000000000000000000000000000..98a23528d08c3af1e5361f8f66130db59be765fd --- /dev/null +++ b/src/main/java/com/example/HelloServlet.java @@ -0,0 +1,20 @@ +package com.example; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.PrintWriter; +public class HelloServlet extends HttpServlet{ + //方法定义,表示处理客户端的 HTTP GET 请求的方法。在这个方法中,我们将生成一个简单的 HTML 页面作为响应。 + //HttpServletRequest 对象代表客户端的 HTTP 请求;HttpServletResponse 对象代表服务器对客户端的 HTTP 响应 + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { + response.setContentType("text/html"); //设置响应的内容类型 + PrintWriter out = response.getWriter(); //通过 response 获取输出流,用于向客户端输出内容。 + out.println(""); + out.println("

Hello ,World!

"); + out.println("

HelloWorld!

"); + out.println(""); + } +} + + diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000000000000000000000000000000000..61712fae8d3862126cf87c20e288b55bd1b72662 --- /dev/null +++ b/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,14 @@ + + + + HelloServlet + com.example.HelloServlet + + + HelloServlet + /hello + + \ No newline at end of file diff --git a/src/test/java/com/example/CalculatorTest.java b/src/test/java/com/example/CalculatorTest.java new file mode 100644 index 0000000000000000000000000000000000000000..9606b4f3ed0728aaf87b4f1efdb10c0b90186e83 --- /dev/null +++ b/src/test/java/com/example/CalculatorTest.java @@ -0,0 +1,15 @@ +package com.example; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.*; +public class CalculatorTest { + public void testAddition(){ + Calculator calculator = new Calculator(); + int result = calculator.add(2,3); + assertEquals(5,result); + } + public void testSubtraction(){ + Calculator calculator = new Calculator(); + int result = calculator.subtract(5,3); + assertEquals(2,result); + } +}