From d058cdbbddad9a0a45797cfb6a8a4a553f05b95a Mon Sep 17 00:00:00 2001 From: "2026659954@qq.com" <2026659954@qq.com> Date: Mon, 27 May 2024 11:38:28 +0800 Subject: [PATCH 1/4] feat'0523' --- .../Main.java" | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 "work/com/java/minxi/java_20240523/java_2301_\346\261\237\346\231\272\346\235\260_2344310106/Main.java" diff --git "a/work/com/java/minxi/java_20240523/java_2301_\346\261\237\346\231\272\346\235\260_2344310106/Main.java" "b/work/com/java/minxi/java_20240523/java_2301_\346\261\237\346\231\272\346\235\260_2344310106/Main.java" new file mode 100644 index 00000000..95f7cb59 --- /dev/null +++ "b/work/com/java/minxi/java_20240523/java_2301_\346\261\237\346\231\272\346\235\260_2344310106/Main.java" @@ -0,0 +1,30 @@ +package com.java.minxi.java_20240523.java_2301_江智杰_2344310106; + +import java.sql.*; + +public class Main { + public static void main(String[] args) { + try { + Class.forName("com.mysql.cj.jdbc.Driver"); + String url="jdbc:mysql://127.0.0.1:3306/xzh?serverTimezone=Asia/Shanghai" + + "" + + ""; + String username="root"; + String password="123456"; + Connection connection = DriverManager.getConnection(url, username, password); + String sql="update xzh set student_name = '张三' where id = 1"; + Statement statement = connection.createStatement(); + int a=statement.executeUpdate(sql); + if (a==1){ + System.out.println("成功"); + }else { + System.out.println("失败"); + } + statement.close(); + connection.close(); + } catch (Exception e) { + e.printStackTrace(); + } + + } +} -- Gitee From 5983c935efbd6b38d8ad5ca95d840fa4a1e7e28b Mon Sep 17 00:00:00 2001 From: "2026659954@qq.com" <2026659954@qq.com> Date: Mon, 27 May 2024 19:58:47 +0800 Subject: [PATCH 2/4] feat'0523' --- java2301.iml | 1 + 1 file changed, 1 insertion(+) diff --git a/java2301.iml b/java2301.iml index bff56e42..eaf242fa 100644 --- a/java2301.iml +++ b/java2301.iml @@ -7,5 +7,6 @@ + \ No newline at end of file -- Gitee From b5c71da3b66fb2a2527cc314c0f0f9fdbc944676 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E7=99=BD?= <2026659954@qq.com> Date: Fri, 7 Jun 2024 16:35:13 +0800 Subject: [PATCH 3/4] 1 --- java2301.iml | 34 +++++++++- .../Main.java" | 41 +++++++----- .../homework1" | 67 +++++++++++++++++++ .../homework2.jsp" | 28 ++++++++ .../circle.jsp" | 11 +++ .../ladder.jsp" | 13 ++++ .../main.jsp" | 15 +++++ 7 files changed, 193 insertions(+), 16 deletions(-) create mode 100644 "work/com/java/minxi/java_20240530/java_2301_\346\261\237\346\231\272\346\235\260_2344310106/homework1" create mode 100644 "work/com/java/minxi/java_20240530/java_2301_\346\261\237\346\231\272\346\235\260_2344310106/homework2.jsp" create mode 100644 "work/com/java/minxi/java_20240603/java_2301_\346\261\237\346\231\272\346\235\260_2344310106/circle.jsp" create mode 100644 "work/com/java/minxi/java_20240603/java_2301_\346\261\237\346\231\272\346\235\260_2344310106/ladder.jsp" create mode 100644 "work/com/java/minxi/java_20240603/java_2301_\346\261\237\346\231\272\346\235\260_2344310106/main.jsp" diff --git a/java2301.iml b/java2301.iml index eaf242fa..34a21c5c 100644 --- a/java2301.iml +++ b/java2301.iml @@ -1,12 +1,44 @@ + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/work/com/java/minxi/java_20240523/java_2301_\346\261\237\346\231\272\346\235\260_2344310106/Main.java" "b/work/com/java/minxi/java_20240523/java_2301_\346\261\237\346\231\272\346\235\260_2344310106/Main.java" index 95f7cb59..6e1ac66e 100644 --- "a/work/com/java/minxi/java_20240523/java_2301_\346\261\237\346\231\272\346\235\260_2344310106/Main.java" +++ "b/work/com/java/minxi/java_20240523/java_2301_\346\261\237\346\231\272\346\235\260_2344310106/Main.java" @@ -1,30 +1,41 @@ package com.java.minxi.java_20240523.java_2301_江智杰_2344310106; -import java.sql.*; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.Statement; public class Main { public static void main(String[] args) { + connectMysql(); + + + } + public static void connectMysql(){ + try { - Class.forName("com.mysql.cj.jdbc.Driver"); - String url="jdbc:mysql://127.0.0.1:3306/xzh?serverTimezone=Asia/Shanghai" + - "" + - ""; - String username="root"; + Class.forName("com.java.cj.jdbc.Driver"); + String url=""; + String usename="root"; String password="123456"; - Connection connection = DriverManager.getConnection(url, username, password); - String sql="update xzh set student_name = '张三' where id = 1"; - Statement statement = connection.createStatement(); - int a=statement.executeUpdate(sql); - if (a==1){ + Connection c=DriverManager.getConnection(url,usename,password); + + String sql=""; + + Statement statement = c.createStatement(); + + int i=statement.executeUpdate(sql); + + if (i==1){ System.out.println("成功"); }else { System.out.println("失败"); } + c.close(); statement.close(); - connection.close(); - } catch (Exception e) { - e.printStackTrace(); - } + }catch (Exception E){ + + } } } diff --git "a/work/com/java/minxi/java_20240530/java_2301_\346\261\237\346\231\272\346\235\260_2344310106/homework1" "b/work/com/java/minxi/java_20240530/java_2301_\346\261\237\346\231\272\346\235\260_2344310106/homework1" new file mode 100644 index 00000000..29ac0e5c --- /dev/null +++ "b/work/com/java/minxi/java_20240530/java_2301_\346\261\237\346\231\272\346\235\260_2344310106/homework1" @@ -0,0 +1,67 @@ +<%-- + Created by IntelliJ IDEA. + User: 孙先优 + Date: 2024/6/6 + Time: 9:46 + To change this template use File | Settings | File Templates. +--%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + Title + + +

+ <%! + class Animal{ + String sleep(int time){ + return "一只动物在睡觉"; + } + } + class Cat extends Animal{ + private String name; + private String time; + + public Cat() { + } + + public Cat(String name, String time) { + this.name = name; + this.time = time; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + + String sleep(int time){ + + return "一只"+getName()+"睡觉睡了"+getTime()+"个小时"; + } + } + + %> + <% + Animal animal = new Animal(); + String sleep1 = animal.sleep(8); + + Animal cat = new Cat("汤姆猫","8"); + String sleep2 = cat.sleep(8); + %> +
<%=sleep1%> +
<%=sleep2%> +

+ + \ No newline at end of file diff --git "a/work/com/java/minxi/java_20240530/java_2301_\346\261\237\346\231\272\346\235\260_2344310106/homework2.jsp" "b/work/com/java/minxi/java_20240530/java_2301_\346\261\237\346\231\272\346\235\260_2344310106/homework2.jsp" new file mode 100644 index 00000000..8366a718 --- /dev/null +++ "b/work/com/java/minxi/java_20240530/java_2301_\346\261\237\346\231\272\346\235\260_2344310106/homework2.jsp" @@ -0,0 +1,28 @@ +<%-- + Created by IntelliJ IDEA. + User: 孙先优 + Date: 2024/6/6 + Time: 9:48 + To change this template use File | Settings | File Templates. +--%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + 九九乘法表 + + +

九九乘法表

+

+ <% + + for (int i = 1; i <= 9; i++) { + for (int j = 1; j <= i; j++) { + out.print(i + "*" + j + "=" + i * j + " "); + } + out.print("
"); + } + + %> +

+ + \ No newline at end of file diff --git "a/work/com/java/minxi/java_20240603/java_2301_\346\261\237\346\231\272\346\235\260_2344310106/circle.jsp" "b/work/com/java/minxi/java_20240603/java_2301_\346\261\237\346\231\272\346\235\260_2344310106/circle.jsp" new file mode 100644 index 00000000..08b89cbd --- /dev/null +++ "b/work/com/java/minxi/java_20240603/java_2301_\346\261\237\346\231\272\346\235\260_2344310106/circle.jsp" @@ -0,0 +1,11 @@ +<%@ page contentType="text/html;charset=UTF-8" %> +<%@ page import="java.text.DecimalFormat" %> +<% + double radius = Double.parseDouble(request.getParameter("radius")); + double area = Math.PI * Math.pow(radius, 2); + DecimalFormat df = new DecimalFormat("#.##"); +%> +

Circle Area Calculation

+

Radius: <%= radius %> units

+

Area: <%= df.format(area) %> square units

+ diff --git "a/work/com/java/minxi/java_20240603/java_2301_\346\261\237\346\231\272\346\235\260_2344310106/ladder.jsp" "b/work/com/java/minxi/java_20240603/java_2301_\346\261\237\346\231\272\346\235\260_2344310106/ladder.jsp" new file mode 100644 index 00000000..b311c55f --- /dev/null +++ "b/work/com/java/minxi/java_20240603/java_2301_\346\261\237\346\231\272\346\235\260_2344310106/ladder.jsp" @@ -0,0 +1,13 @@ +<%@ page contentType="text/html;charset=UTF-8" %> +<%@ page import="java.text.DecimalFormat" %> +<% + double upperBase = Double.parseDouble(request.getParameter("upperBase")); + double lowerBase = Double.parseDouble(request.getParameter("lowerBase")); + double height = Double.parseDouble(request.getParameter("height")); + double area = ((upperBase + lowerBase) / 2) * height; + DecimalFormat df = new DecimalFormat("#.##"); +%> +

Ladder Area Calculation

+

Upper Base: <%= upperBase %> units

+

Lower Base: <%= lowerBase %> units

+

Height: <%= height %> units

\ No newline at end of file diff --git "a/work/com/java/minxi/java_20240603/java_2301_\346\261\237\346\231\272\346\235\260_2344310106/main.jsp" "b/work/com/java/minxi/java_20240603/java_2301_\346\261\237\346\231\272\346\235\260_2344310106/main.jsp" new file mode 100644 index 00000000..db009fb2 --- /dev/null +++ "b/work/com/java/minxi/java_20240603/java_2301_\346\261\237\346\231\272\346\235\260_2344310106/main.jsp" @@ -0,0 +1,15 @@ +<%@ page contentType="text/html;charset=UTF-8" %> + + + + Main Page + + +

Main Page

+ +<%@ include file="circle.jsp" %> +<%@ include file="ladder.jsp" %> + +

Calculations done!

+ + \ No newline at end of file -- Gitee From 26efcf56d69d1af611f9de03642e90fc7e9eb8ec Mon Sep 17 00:00:00 2001 From: Laofan <545690097@qq.com> Date: Tue, 11 Jun 2024 08:39:28 +0800 Subject: [PATCH 4/4] =?UTF-8?q?fix=20:=20=E6=95=B4=E7=90=86=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/WEB-INF/web.xml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 web/WEB-INF/web.xml diff --git a/web/WEB-INF/web.xml b/web/WEB-INF/web.xml new file mode 100644 index 00000000..d80081d1 --- /dev/null +++ b/web/WEB-INF/web.xml @@ -0,0 +1,6 @@ + + + \ No newline at end of file -- Gitee