diff --git a/Servlet_login/.idea/.gitignore b/Servlet_login/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..73f69e0958611ac6e00bde95641f6699030ad235 --- /dev/null +++ b/Servlet_login/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/Servlet_login/.idea/artifacts/LoginDemo02.xml b/Servlet_login/.idea/artifacts/LoginDemo02.xml new file mode 100644 index 0000000000000000000000000000000000000000..2a09861add8a06bdb79c9ce96edd148383ec6eeb --- /dev/null +++ b/Servlet_login/.idea/artifacts/LoginDemo02.xml @@ -0,0 +1,13 @@ + + + $PROJECT_DIR$/out/artifacts/LoginDemo02 + + + + + + + + + + \ No newline at end of file diff --git a/Servlet_login/.idea/codeStyles/Project.xml b/Servlet_login/.idea/codeStyles/Project.xml new file mode 100644 index 0000000000000000000000000000000000000000..919ce1f1f77253454105acb2aad9997c1047a0e6 --- /dev/null +++ b/Servlet_login/.idea/codeStyles/Project.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/Servlet_login/.idea/codeStyles/codeStyleConfig.xml b/Servlet_login/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000000000000000000000000000000000000..a55e7a179bde3e4e772c29c0c85e53354aa54618 --- /dev/null +++ b/Servlet_login/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/Servlet_login/.idea/misc.xml b/Servlet_login/.idea/misc.xml new file mode 100644 index 0000000000000000000000000000000000000000..05483570e041eb648703359441d61bf9a5feeb13 --- /dev/null +++ b/Servlet_login/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Servlet_login/.idea/modules.xml b/Servlet_login/.idea/modules.xml new file mode 100644 index 0000000000000000000000000000000000000000..bf440b4841b1e82f7eb664b3ee2c98b92979a022 --- /dev/null +++ b/Servlet_login/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Servlet_login/out/artifacts/LoginDemo02/WEB-INF/web.xml b/Servlet_login/out/artifacts/LoginDemo02/WEB-INF/web.xml new file mode 100644 index 0000000000000000000000000000000000000000..d80081d1318531b6c30eaf0d748bf80a0b2e042a --- /dev/null +++ b/Servlet_login/out/artifacts/LoginDemo02/WEB-INF/web.xml @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/Servlet_login/out/artifacts/LoginDemo02/failure.jsp b/Servlet_login/out/artifacts/LoginDemo02/failure.jsp new file mode 100644 index 0000000000000000000000000000000000000000..84fafc658ec5eb4f3dca109f79f4b7624543d9db --- /dev/null +++ b/Servlet_login/out/artifacts/LoginDemo02/failure.jsp @@ -0,0 +1,16 @@ +<%-- + Created by IntelliJ IDEA. + User: ASUS + Date: 2024/4/13 + Time: 17:46 + To change this template use File | Settings | File Templates. +--%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + 登陆失败 + + +

遗憾,<%=request.getParameter("username")%>登录失败!

+ + diff --git a/Servlet_login/out/artifacts/LoginDemo02/index.jsp b/Servlet_login/out/artifacts/LoginDemo02/index.jsp new file mode 100644 index 0000000000000000000000000000000000000000..5f3a21b5a81540f74aec3d0b917f20e668997597 --- /dev/null +++ b/Servlet_login/out/artifacts/LoginDemo02/index.jsp @@ -0,0 +1,17 @@ +<%-- + Created by IntelliJ IDEA. + User: ASUS + Date: 2024/4/13 + Time: 17:21 + To change this template use File | Settings | File Templates. +--%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + 首页 + + +

JSP+Servlet方式实现用户登录功能

+

跳转到登录页面

+ + diff --git a/Servlet_login/out/artifacts/LoginDemo02/login.jsp b/Servlet_login/out/artifacts/LoginDemo02/login.jsp new file mode 100644 index 0000000000000000000000000000000000000000..a36960312e5d6ea64708af7120b0d5e6aee2c10a --- /dev/null +++ b/Servlet_login/out/artifacts/LoginDemo02/login.jsp @@ -0,0 +1,34 @@ +<%-- + Created by IntelliJ IDEA. + User: ASUS + Date: 2024/4/13 + Time: 17:24 + To change this template use File | Settings | File Templates. +--%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + 用户登录 + + +

用户登录

+
+ + + + + + + + + + + + +
账号
密码
+ + +
+
+ + diff --git a/Servlet_login/out/artifacts/LoginDemo02/success.jsp b/Servlet_login/out/artifacts/LoginDemo02/success.jsp new file mode 100644 index 0000000000000000000000000000000000000000..7ab7a7d58d4e8a3fe0413034a14a794de6260501 --- /dev/null +++ b/Servlet_login/out/artifacts/LoginDemo02/success.jsp @@ -0,0 +1,16 @@ +<%-- + Created by IntelliJ IDEA. + User: ASUS + Date: 2024/4/13 + Time: 17:44 + To change this template use File | Settings | File Templates. +--%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + 登录成功 + + +

恭喜,<%=request.getParameter("username")%>登录成功!

+ + diff --git a/Servlet_login/src/net/lh/servlet/LoginServlet.java b/Servlet_login/src/net/lh/servlet/LoginServlet.java new file mode 100644 index 0000000000000000000000000000000000000000..b9a7a340fcac64f6fc985d35c90c55194bda0e17 --- /dev/null +++ b/Servlet_login/src/net/lh/servlet/LoginServlet.java @@ -0,0 +1,32 @@ +package net.lh.servlet; + +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; +import java.net.URLEncoder; + +@WebServlet(name = "LoginServlet",urlPatterns = "/login") +public class LoginServlet extends HttpServlet { + protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + //设置请求对象字符编码格式 + request.setCharacterEncoding("utf-8"); + //获取登录表单数据 + String username=request.getParameter("username"); + String password=request.getParameter("password"); + //判断是否登录成功 + if (username.equals("高剑锋")&&password.equals("903213")){ + response.sendRedirect("success.jsp?username="+ URLEncoder.encode(username,"utf-8")); + }else { + response.sendRedirect("failure.jsp?username="+URLEncoder.encode(username,"utf-8")); + } + } + + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + + doPost(request,response); + } + } + diff --git a/Servlet_login/web/WEB-INF/web.xml b/Servlet_login/web/WEB-INF/web.xml new file mode 100644 index 0000000000000000000000000000000000000000..d80081d1318531b6c30eaf0d748bf80a0b2e042a --- /dev/null +++ b/Servlet_login/web/WEB-INF/web.xml @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/Servlet_login/web/failure.jsp b/Servlet_login/web/failure.jsp new file mode 100644 index 0000000000000000000000000000000000000000..84fafc658ec5eb4f3dca109f79f4b7624543d9db --- /dev/null +++ b/Servlet_login/web/failure.jsp @@ -0,0 +1,16 @@ +<%-- + Created by IntelliJ IDEA. + User: ASUS + Date: 2024/4/13 + Time: 17:46 + To change this template use File | Settings | File Templates. +--%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + 登陆失败 + + +

遗憾,<%=request.getParameter("username")%>登录失败!

+ + diff --git a/Servlet_login/web/index.jsp b/Servlet_login/web/index.jsp new file mode 100644 index 0000000000000000000000000000000000000000..5f3a21b5a81540f74aec3d0b917f20e668997597 --- /dev/null +++ b/Servlet_login/web/index.jsp @@ -0,0 +1,17 @@ +<%-- + Created by IntelliJ IDEA. + User: ASUS + Date: 2024/4/13 + Time: 17:21 + To change this template use File | Settings | File Templates. +--%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + 首页 + + +

JSP+Servlet方式实现用户登录功能

+

跳转到登录页面

+ + diff --git a/Servlet_login/web/login.jsp b/Servlet_login/web/login.jsp new file mode 100644 index 0000000000000000000000000000000000000000..a36960312e5d6ea64708af7120b0d5e6aee2c10a --- /dev/null +++ b/Servlet_login/web/login.jsp @@ -0,0 +1,34 @@ +<%-- + Created by IntelliJ IDEA. + User: ASUS + Date: 2024/4/13 + Time: 17:24 + To change this template use File | Settings | File Templates. +--%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + 用户登录 + + +

用户登录

+
+ + + + + + + + + + + + +
账号
密码
+ + +
+
+ + diff --git a/Servlet_login/web/success.jsp b/Servlet_login/web/success.jsp new file mode 100644 index 0000000000000000000000000000000000000000..7ab7a7d58d4e8a3fe0413034a14a794de6260501 --- /dev/null +++ b/Servlet_login/web/success.jsp @@ -0,0 +1,16 @@ +<%-- + Created by IntelliJ IDEA. + User: ASUS + Date: 2024/4/13 + Time: 17:44 + To change this template use File | Settings | File Templates. +--%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + 登录成功 + + +

恭喜,<%=request.getParameter("username")%>登录成功!

+ + diff --git a/untitled1/.idea/.gitignore b/untitled1/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..73f69e0958611ac6e00bde95641f6699030ad235 --- /dev/null +++ b/untitled1/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/untitled1/.idea/codeStyles/Project.xml b/untitled1/.idea/codeStyles/Project.xml new file mode 100644 index 0000000000000000000000000000000000000000..919ce1f1f77253454105acb2aad9997c1047a0e6 --- /dev/null +++ b/untitled1/.idea/codeStyles/Project.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/untitled1/.idea/codeStyles/codeStyleConfig.xml b/untitled1/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000000000000000000000000000000000000..a55e7a179bde3e4e772c29c0c85e53354aa54618 --- /dev/null +++ b/untitled1/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/untitled1/.idea/compiler.xml b/untitled1/.idea/compiler.xml new file mode 100644 index 0000000000000000000000000000000000000000..443c13689f9c1594e8cf645754aab8ea62c41486 --- /dev/null +++ b/untitled1/.idea/compiler.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/untitled1/.idea/encodings.xml b/untitled1/.idea/encodings.xml new file mode 100644 index 0000000000000000000000000000000000000000..aa00ffab7828f4818589659c804ec2cfd99baed3 --- /dev/null +++ b/untitled1/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/untitled1/.idea/jarRepositories.xml b/untitled1/.idea/jarRepositories.xml new file mode 100644 index 0000000000000000000000000000000000000000..712ab9d985c20018a0c97b93d2148ac1ffe588a5 --- /dev/null +++ b/untitled1/.idea/jarRepositories.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/untitled1/.idea/misc.xml b/untitled1/.idea/misc.xml new file mode 100644 index 0000000000000000000000000000000000000000..e04082e1094ce03892946042f4760f32917cc008 --- /dev/null +++ b/untitled1/.idea/misc.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/untitled1/pom.xml b/untitled1/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..1befed56816f260ee04a996efdb00a4ed2cb0b25 --- /dev/null +++ b/untitled1/pom.xml @@ -0,0 +1,76 @@ + + + + 4.0.0 + + org.example + untitled1 + 1.0-SNAPSHOT + war + + untitled1 Maven Webapp + + http://www.example.com + + + UTF-8 + 1.7 + 1.7 + + + + + junit + junit + 4.11 + test + + + + + + + + + + + + + + untitled1 + + + + maven-clean-plugin + 3.1.0 + + + + maven-resources-plugin + 3.0.2 + + + maven-compiler-plugin + 3.8.0 + + + maven-surefire-plugin + 2.22.1 + + + maven-war-plugin + 3.2.2 + + + maven-install-plugin + 2.5.2 + + + maven-deploy-plugin + 2.8.2 + + + + + diff --git a/untitled1/src/main/java/org/qiu/Calculate.java b/untitled1/src/main/java/org/qiu/Calculate.java new file mode 100644 index 0000000000000000000000000000000000000000..70a95fc275e9d59977a3c25f644ac44708f13242 --- /dev/null +++ b/untitled1/src/main/java/org/qiu/Calculate.java @@ -0,0 +1,18 @@ +package org.qiu; + +public class Calculate { + public int add(int x,int y){ + return x+y; + } + public int mul(int x,int y){ + return x*y; + } + public float div(int x,int y){ + return x/y; + } + public int sub(int x,int y){ + return x-y; + System.out.println("cherrypick"); + } + +} diff --git a/untitled1/src/main/webapp/WEB-INF/web.xml b/untitled1/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000000000000000000000000000000000..9f88c1f9632445500e3b3688fe477b860f77d8f2 --- /dev/null +++ b/untitled1/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,7 @@ + + + + Archetype Created Web Application + diff --git a/untitled1/src/main/webapp/index.jsp b/untitled1/src/main/webapp/index.jsp new file mode 100644 index 0000000000000000000000000000000000000000..c38169bb958579c635a5c09ee2f379cc5956c0c2 --- /dev/null +++ b/untitled1/src/main/webapp/index.jsp @@ -0,0 +1,5 @@ + + +

Hello World!

+ + diff --git a/untitled1/src/main/webapp/test.html b/untitled1/src/main/webapp/test.html new file mode 100644 index 0000000000000000000000000000000000000000..8fa34b2dbae5a697632e307f9ca7bf9487073292 --- /dev/null +++ b/untitled1/src/main/webapp/test.html @@ -0,0 +1,10 @@ + + + + + Title + + +我是测试页! + + \ No newline at end of file diff --git a/untitled1/src/test/java/org/qiu/CalculateTest.java b/untitled1/src/test/java/org/qiu/CalculateTest.java new file mode 100644 index 0000000000000000000000000000000000000000..c6f4f57a1caeeb07267f52a70b95d84d7e0fa58e --- /dev/null +++ b/untitled1/src/test/java/org/qiu/CalculateTest.java @@ -0,0 +1,37 @@ +package org.qiu; + +import org.junit.Test; + +import static org.junit.Assert.*; + +public class CalculateTest { + private Calculate calculate=new Calculate(); + @Test + public void add() { + System.out.println(calculate.add(15,5)); + } + + @Test + public void mul() { + System.out.println(calculate.mul(2,5)); + } + + @Test + public void div() { + System.out.println(calculate.div(5,6)); + } + + @Test + public void sub() { + System.out.println(calculate.sub(18,3)); + } + public void sub(){ + System.out.println("分支二上第一次修改"); + } + public void sub(){ + System.out.println("分支二上第二次修改"); + } + public void sub(){ + System.out.println("分支二上第三次修改"); + } +} diff --git a/untitled1/target/untitled1/META-INF/MANIFEST.MF b/untitled1/target/untitled1/META-INF/MANIFEST.MF new file mode 100644 index 0000000000000000000000000000000000000000..cceb555c389b487ea3bd28d5a237f7cd89103d8d --- /dev/null +++ b/untitled1/target/untitled1/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Created-By: IntelliJ IDEA +Built-By: ASUS +Build-Jdk: 1.8.0_191 + diff --git a/untitled1/target/untitled1/WEB-INF/web.xml b/untitled1/target/untitled1/WEB-INF/web.xml new file mode 100644 index 0000000000000000000000000000000000000000..9f88c1f9632445500e3b3688fe477b860f77d8f2 --- /dev/null +++ b/untitled1/target/untitled1/WEB-INF/web.xml @@ -0,0 +1,7 @@ + + + + Archetype Created Web Application + diff --git a/untitled1/target/untitled1/index.jsp b/untitled1/target/untitled1/index.jsp new file mode 100644 index 0000000000000000000000000000000000000000..c38169bb958579c635a5c09ee2f379cc5956c0c2 --- /dev/null +++ b/untitled1/target/untitled1/index.jsp @@ -0,0 +1,5 @@ + + +

Hello World!

+ + diff --git a/untitled1/target/untitled1/test.html b/untitled1/target/untitled1/test.html new file mode 100644 index 0000000000000000000000000000000000000000..8fa34b2dbae5a697632e307f9ca7bf9487073292 --- /dev/null +++ b/untitled1/target/untitled1/test.html @@ -0,0 +1,10 @@ + + + + + Title + + +我是测试页! + + \ No newline at end of file