UserJoin 관련
- Dao, Vo, Command 수정 필요 - 생일 관련 Date 자료형 처리 논의 필요.
This commit is contained in:
77
hospital/src/main/java/UserJoin/UserJoinDao.java
Normal file
77
hospital/src/main/java/UserJoin/UserJoinDao.java
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
package UserJoin;
|
||||||
|
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import DB.BasicDao;
|
||||||
|
import DB.MemberVo;
|
||||||
|
|
||||||
|
public class UserJoinDao extends BasicDao {
|
||||||
|
private final String MEMBER_LIST = "SELECT * FROM member";
|
||||||
|
private final String MEMBER_CHECK = "SELECT * FROM member WHERE id = ? and pw = ?";
|
||||||
|
private final String MEMBER_INSERT = "INSERT into member values(?,?,?,?,?,?,?)";
|
||||||
|
|
||||||
|
public ArrayList<MemberVo> select() {
|
||||||
|
ArrayList list = new ArrayList();
|
||||||
|
|
||||||
|
try {
|
||||||
|
this.psmt = this.conn.prepareStatement("SELECT * FROM member");
|
||||||
|
this.rs = this.psmt.executeQuery();
|
||||||
|
|
||||||
|
while(this.rs.next()) {
|
||||||
|
MemberVo member = new MemberVo();
|
||||||
|
member.setId(this.rs.getString("ID"));
|
||||||
|
member.setName(this.rs.getString("NAME"));
|
||||||
|
member.setAddr(this.rs.getString("ADDR"));
|
||||||
|
member.setTel(this.rs.getString("TEL"));
|
||||||
|
member.setGender(this.rs.getString("GENDER"));
|
||||||
|
member.setHobby(this.rs.getString("HOBBY"));
|
||||||
|
list.add(member);
|
||||||
|
}
|
||||||
|
} catch (SQLException var3) {
|
||||||
|
var3.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MemberVo selectMember(MemberVo member) {
|
||||||
|
MemberVo vo = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
this.psmt = this.conn.prepareStatement("SELECT * FROM member WHERE id = ? and pw = ?");
|
||||||
|
this.psmt.setString(1, member.getId());
|
||||||
|
this.psmt.setString(2, member.getPw());
|
||||||
|
this.rs = this.psmt.executeQuery();
|
||||||
|
if (this.rs.next()) {
|
||||||
|
String id = this.rs.getString("id");
|
||||||
|
String pw = this.rs.getString("pw");
|
||||||
|
vo = new MemberVo(id, pw);
|
||||||
|
}
|
||||||
|
} catch (SQLException var5) {
|
||||||
|
var5.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int memberInsert(MemberVo member) {
|
||||||
|
int n = 0;
|
||||||
|
|
||||||
|
try {
|
||||||
|
this.psmt = this.conn.prepareStatement("INSERT into member values(?,?,?,?,?,?,?)");
|
||||||
|
this.psmt.setString(1, member.getId());
|
||||||
|
this.psmt.setString(2, member.getName());
|
||||||
|
this.psmt.setString(3, member.getPw());
|
||||||
|
this.psmt.setString(4, member.getAddr());
|
||||||
|
this.psmt.setString(5, member.getTel());
|
||||||
|
this.psmt.setString(6, member.getGender());
|
||||||
|
this.psmt.setString(7, member.getHobby());
|
||||||
|
n = this.psmt.executeUpdate();
|
||||||
|
} catch (SQLException var4) {
|
||||||
|
var4.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
}
|
||||||
82
hospital/src/main/java/UserJoin/UserJoinVo.java
Normal file
82
hospital/src/main/java/UserJoin/UserJoinVo.java
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
package UserJoin;
|
||||||
|
|
||||||
|
public class UserJoinVo {
|
||||||
|
public String u_ID;
|
||||||
|
public String u_name;
|
||||||
|
public String u_psw;
|
||||||
|
public String u_addr;
|
||||||
|
public String u_phone;
|
||||||
|
public String u_gender;
|
||||||
|
public String u_post;
|
||||||
|
public Date u_birth;
|
||||||
|
public String u_divi;
|
||||||
|
public String u_car_num;
|
||||||
|
|
||||||
|
public UserJoinVo(String id, String pw) {
|
||||||
|
this.id = id;
|
||||||
|
this.pw = pw;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return this.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAddr() {
|
||||||
|
return this.addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddr(String addr) {
|
||||||
|
this.addr = addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTel() {
|
||||||
|
return this.tel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTel(String tel) {
|
||||||
|
this.tel = tel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGender() {
|
||||||
|
return this.gender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGender(String gender) {
|
||||||
|
this.gender = gender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHobby() {
|
||||||
|
return this.hobby;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHobby(String hobby) {
|
||||||
|
this.hobby = hobby;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPw() {
|
||||||
|
return this.pw;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPw(String pw) {
|
||||||
|
this.pw = pw;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(String u_birth)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
public String u_divi;
|
||||||
|
public String u_car_num;
|
||||||
|
}
|
||||||
@@ -6,9 +6,52 @@ import javax.servlet.ServletException;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import DB.MemberDao;
|
||||||
|
import DB.MemberVo;
|
||||||
|
|
||||||
public class UserJoinCommand implements Command {
|
public class UserJoinCommand implements Command {
|
||||||
@Override
|
|
||||||
public String exec(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
public String exec(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
return "UserJoin.jsp";
|
String id = request.getParameter("u_ID");
|
||||||
|
String name = request.getParameter("u_name");
|
||||||
|
String pw = request.getParameter("u_psw");
|
||||||
|
String addr = request.getParameter("addr");
|
||||||
|
String tel = request.getParameter("tel");
|
||||||
|
String gender = request.getParameter("gender");
|
||||||
|
String[] hobbies = request.getParameterValues("hobby");
|
||||||
|
String hobbyString = "";
|
||||||
|
int n;
|
||||||
|
String path;
|
||||||
|
if (hobbies != null) {
|
||||||
|
String[] var11 = hobbies;
|
||||||
|
int var12 = hobbies.length;
|
||||||
|
|
||||||
|
for(n = 0; n < var12; ++n) {
|
||||||
|
path = var11[n];
|
||||||
|
hobbyString = hobbyString + path;
|
||||||
|
hobbyString = hobbyString + ":";
|
||||||
|
}
|
||||||
|
|
||||||
|
hobbyString = hobbyString.substring(0, hobbyString.length() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
MemberVo member = new MemberVo();
|
||||||
|
member.setId(id);
|
||||||
|
member.setName(name);
|
||||||
|
member.setPw(pw);
|
||||||
|
member.setAddr(addr);
|
||||||
|
member.setTel(tel);
|
||||||
|
member.setGender(gender);
|
||||||
|
member.setHobby(hobbyString);
|
||||||
|
MemberDao dao = new MemberDao();
|
||||||
|
n = dao.memberInsert(member);
|
||||||
|
if (n != 0) {
|
||||||
|
request.setAttribute("joinName", name);
|
||||||
|
path = "views/student/joinOk.jsp";
|
||||||
|
} else {
|
||||||
|
path = "views/student/joinFail.jsp";
|
||||||
|
}
|
||||||
|
|
||||||
|
return path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -15,27 +15,27 @@
|
|||||||
function formDataCheck(){
|
function formDataCheck(){
|
||||||
var form = document.frm;
|
var form = document.frm;
|
||||||
|
|
||||||
if(form.name.value==""){
|
if(form.u_name.value==""){
|
||||||
alert("사용자 이름을 입력하세요.");
|
alert("사용자 이름을 입력하세요.");
|
||||||
form.name.focus();
|
form.u_name.focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(form.id.value==""){
|
if(form.u_ID.value==""){
|
||||||
alert("사용자 아이디를 입력하세요.");
|
alert("사용자 아이디를 입력하세요.");
|
||||||
form.id.focus();
|
form.u_ID.focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(form.pw.value==""){
|
if(form.u_psw.value==""){
|
||||||
alert("사용자 비밀번호를 입력하세요.");
|
alert("사용자 비밀번호를 입력하세요.");
|
||||||
form.pw.focus();
|
form.u_psw.focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(form.pwCheck.value==""){
|
if(form.u_pswCheck.value==""){
|
||||||
alert("사용자 비밀번호 확인값을 입력하세요.");
|
alert("사용자 비밀번호 확인값을 입력하세요.");
|
||||||
form.pwCheck.focus();
|
form.u_pswCheck.focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
<!-- form.submit(); button type -->
|
<!-- form.submit(); button type -->
|
||||||
@@ -51,46 +51,46 @@
|
|||||||
<div><h1>임직원 회원 가입</h1></div>
|
<div><h1>임직원 회원 가입</h1></div>
|
||||||
<br/>
|
<br/>
|
||||||
<div>
|
<div>
|
||||||
<form id="frm" name="frm" action="memberInsert.do" method="post" onsubmit="return formDataCheck()">
|
<form id="frm" name="frm" action="UserJoin.do" method="post" onsubmit="return formDataCheck()">
|
||||||
<div>
|
<div>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">회원명</th><td colspan="3"><input class="form-control" style="width:30%" type="text" id="name" name="name" maxlength="10"></td>
|
<th scope="row">회원명</th><td colspan="3"><input class="form-control" style="width:30%" type="text" id="u_name" name="u_name" maxlength="10"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">회원ID</th><td colspan="3"> <input class="form-control d-inline" style="width:30%" type="text" id="id" name="id" maxlength="10"> <input class="btn btn-info" type="button" value="중복확인" onclick="idValidCheck()"></td>
|
<th scope="row">회원ID</th><td colspan="3"> <input class="form-control d-inline" style="width:30%" type="text" id="u_ID" name="u_ID" maxlength="10"> <input class="btn btn-info" type="button" value="중복확인" onclick="idValidCheck()"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">패스워드</th><td colspan="3"><input class="form-control" style="width:30%" id="pw" name="pw" type="password" size="10"></td>
|
<th scope="row">패스워드</th><td colspan="3"><input class="form-control" style="width:30%" id="u_psw" name="u_psw" type="password" size="10"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">패스워드확인</th><td colspan="3"><input class="form-control" style="width:30%" id="pwCheck" name="pwCheck" type="password" size="10"></td>
|
<th scope="row">패스워드확인</th><td colspan="3"><input class="form-control" style="width:30%" id="u_pswCheck" name="u_pswCheck" type="password" size="10"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">주소</th><td colspan="3"><input class="form-control" id="addr" name="addr" type="text" maxlength="50"></td>
|
<th scope="row">주소</th><td colspan="3"><input class="form-control" id="u_addr" name="u_addr" type="text" maxlength="50"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">전화번호</th><td><input class="form-control" id="tel" name="tel" type="tel" style="width:30%" maxlength="15"></td>
|
<th scope="row">전화번호</th><td><input class="form-control" id="u_phone" name="u_phone" type="tel" style="width:30%" maxlength="15"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">차량번호</th><td><input class="form-control" id="u_car_num" name="u_car_num" type="text" style="width:30%" maxlength="15"></td>
|
<th scope="row">차량번호</th><td><input class="form-control" id="u_car_num" name="u_car_num" type="text" style="width:30%" maxlength="15"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">생년월일</th><td><input class="form-control" id="u_birth" name="u_birth" type="number" style="width:30%" maxlength="6"></td>
|
<th scope="row">생년월일</th><td><input class="form-control" id="u_birth" name="u_birth" type="date" style="width:30%" maxlength="6"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">병과</th><td><input class="form-control" id="u_car_num" name="u_car_num" type="text" style="width:30%" maxlength="15"></td>
|
<th scope="row">병과</th><td><input class="form-control" id="u_divi" name="u_divi" type="text" style="width:30%" maxlength="15"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">성별</th>
|
<th scope="row">성별</th>
|
||||||
<td>
|
<td>
|
||||||
<div class="custom-control custom-radio custom-control-inline">
|
<div class="custom-control custom-radio custom-control-inline">
|
||||||
<input class="custom-control-input" type="radio" id="male" name="gender" value="male" checked>
|
<input class="custom-control-input" type="radio" id="male" name="u_gender" value="male" checked>
|
||||||
<label class="custom-control-label" for="male">남성</label>
|
<label class="custom-control-label" for="male">남성</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="custom-control custom-radio custom-control-inline">
|
<div class="custom-control custom-radio custom-control-inline">
|
||||||
<input class="custom-control-input" type="radio" id="female" name="gender"value="female">
|
<input class="custom-control-input" type="radio" id="female" name="u_gender"value="female">
|
||||||
<label class="custom-control-label" for="female">여성</label>
|
<label class="custom-control-label" for="female">여성</label>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user