diff --git a/pom.xml b/pom.xml index f5d448122d70cd4049acc7486c7172960adaae95..d49bfa2e4799ec207fdd3112a547cead6a90b74e 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 imu.g3 - web-framework-spring + group3-springmvc 1.0-SNAPSHOT war diff --git a/src/main/java/imu/g3/dao/UserDao.java b/src/main/java/imu/g3/dao/UserDao.java index dae221685cdda94e69be1409256b611145e9cb66..663eabb8e8fae613bd8a372df2780cd7c4456eff 100644 --- a/src/main/java/imu/g3/dao/UserDao.java +++ b/src/main/java/imu/g3/dao/UserDao.java @@ -20,15 +20,12 @@ public class UserDao { public int register(User user) { //获取与MySQL链接的Connection对象 Connection conn = null; - Statement st = null; - ResultSet rs = null; PreparedStatement ptst = null; int res = 0; SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式 String date = df.format(new Date());// new Date()为获取当前系统时间,也可使用当前时间戳 try { String insert = "insert into user(name,phone,password,regdate,email) values(?,?,?,?,?)"; - conn = new DataUtil().getConnection(); ptst = conn.prepareStatement(insert); ptst.setString(1, user.getName()); @@ -36,7 +33,6 @@ public class UserDao { ptst.setString(3, user.getPassword()); ptst.setString(4, date); ptst.setString(5, user.getEmail()); - //执行sql语句 ptst.execute(); res = ptst.getUpdateCount(); diff --git a/src/main/webapp/WEB-INF/applicationContext.xml b/src/main/webapp/WEB-INF/applicationContext.xml index 142def25af216f4857576c4578f242f5d1c28d5c..9aa7dbfefd76e654e601f7944102300cfa1fd934 100644 --- a/src/main/webapp/WEB-INF/applicationContext.xml +++ b/src/main/webapp/WEB-INF/applicationContext.xml @@ -1,6 +1,12 @@ + xmlns:context="http://www.springframework.org/schema/context" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd"> + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/dispatcher-servlet.xml b/src/main/webapp/WEB-INF/dispatcher-servlet.xml index 53be1832ae7aab3c8638cb001204ced93e9067fc..fc8a4c92d1054e8547d2419a77a96e4d68abd940 100644 --- a/src/main/webapp/WEB-INF/dispatcher-servlet.xml +++ b/src/main/webapp/WEB-INF/dispatcher-servlet.xml @@ -5,33 +5,32 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"> - - - + + + + + - - + - - - - - - + + + + diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index affd7cbde397b658dc8491ab8750e0326c850a19..e7b151ab768a94970d3952ca862c15a181a55a26 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -3,6 +3,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" version="4.0"> + + contextConfigLocation /WEB-INF/applicationContext.xml @@ -10,15 +12,23 @@ org.springframework.web.context.ContextLoaderListener + + dispatcher org.springframework.web.servlet.DispatcherServlet + + contextConfigLocation + /WEB-INF/dispatcher-servlet.xml + 1 dispatcher / + + /view/pages/login.jsp @@ -44,6 +54,7 @@ *.png + CharacterEncodingFilter org.springframework.web.filter.CharacterEncodingFilter diff --git a/src/main/webapp/view/pages/my.jsp b/src/main/webapp/view/pages/my.jsp index 4322012f7ef6e855e32193d4fb9f8138a2f3d1e4..7e6f232c1320b0843019ff3d1f14d8c0cae27ad5 100644 --- a/src/main/webapp/view/pages/my.jsp +++ b/src/main/webapp/view/pages/my.jsp @@ -52,7 +52,7 @@ Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, Sony
    - +