Merge remote-tracking branch 'remotes/origin/wlf' into wmj

# Conflicts:
#	GDMS.iml
#	src/servlet/account/login.java
wlf
wan 6 years ago
commit 7e7a4a96bb

@ -7,6 +7,9 @@
<element id="directory" name="classes"> <element id="directory" name="classes">
<element id="module-output" name="GDMS" /> <element id="module-output" name="GDMS" />
</element> </element>
<element id="directory" name="lib">
<element id="file-copy" path="C:/Program Files/apache-tomcat-9.0.13/lib/tomcat-jdbc.jar" />
</element>
</element> </element>
</root> </root>
</artifact> </artifact>

@ -0,0 +1,24 @@
package servlet;
import core.process.C_TeacherSelectStudent;
import core.user.User;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public class S_TeacherSelectStudent extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
super.doPost(request, response);
String teacher_id=request.getParameter("id");
User user=(User)request.getSession().getAttribute("User");
String student_id=user.getId();
try {
new C_TeacherSelectStudent().select(teacher_id,student_id);
} catch (Exception e) {
e.printStackTrace();
}
}
}

@ -1,4 +1,46 @@
package servlet.account; package servlet.account;
public class S_Register { import core.user.User;
} import core.user.utils.AccountManagement;
import error.GExcptAccount;
import error.GExcptSQL;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
public class S_Register extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
super.doPost(request, response);
Map<String,String> user_info=new HashMap<>();
String id=request.getParameter("id");
user_info.put("id",id);
String name=request.getParameter("name");
user_info.put("name",name);
String e_mail=request.getParameter("e-mail");
user_info.put("e_mail",e_mail);
String phone_number=request.getParameter("phone-number");
user_info.put("phone_number",phone_number);
String password=request.getParameter("password");
user_info.put("password",password);
User user=null;
try {
user = AccountManagement.register("student",user_info);
} catch (GExcptSQL gExcptSQL) {
gExcptSQL.printStackTrace();
} catch (GExcptAccount gExcptAccount) {
gExcptAccount.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
//注册失败
request.getSession().setAttribute("User",user);
request.getRequestDispatcher("/home.jsp").forward(request,response);
}
}

@ -33,8 +33,6 @@ public class login extends HttpServlet {
} }
request.getSession().setAttribute("User",user); request.getSession().setAttribute("User",user);
request.getRequestDispatcher("/home.jsp").forward(request,response); request.getRequestDispatcher("/home.jsp").forward(request,response);
request.getSession().setAttribute("User",user);
request.getRequestDispatcher("/home.jsp").forward(request,response);
} }
protected void doGet(HttpServletRequest request, HttpServletResponse response) protected void doGet(HttpServletRequest request, HttpServletResponse response)

@ -0,0 +1,4 @@
package servlet.basic_settings;
public class S_Listener {
}

@ -56,7 +56,7 @@
<select class="id-check"> <select class="id-check">
<option value="">身份</option> <option value="">身份</option>
<option value="student">学生</option> <option value="student">学生</option>
<option value="teacher">老师</option> <option v alue="teacher">老师</option>
</select> </select>
<input class="register-submit-style" type="submit" value="注册"> <input class="register-submit-style" type="submit" value="注册">
</form> </form>

@ -25,7 +25,7 @@
<div class="select-blank"></div> <div class="select-blank"></div>
<div class="selected-bottom"></div> <div class="selected-bottom"></div>
</div> </div>
<div class="list-frame bar-change"> <div class="list-frame bar-hange">c
<div class="list-child"> <div class="list-child">
<div class="name"><span class="the-name">李先生</span></div> <div class="name"><span class="the-name">李先生</span></div>
<div class="other-msgs"> <div class="other-msgs">

Loading…
Cancel
Save