<aside> 💡 webapp → WEB-INF → lib에 필요한 파일
<aside> 💡 절대경로 구하기
<body>
<%
//프로젝트 경로구하기
String root = request.getContextPath();
%>
<%=root%>
</body>
</aside>
<a href="<%=root%>/index.jsp?main=member/memberlist.jsp">회원가입</a>
메인에 membeer/memberlist.jsp를 띄우겠다
MemberDao.java
// 아이디 중복체크
public int isIdCheck(String id) {
int isid = 0;
Connection conn = db.getConnection();
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "select count(*) from member where id=?";
try {
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, id);
rs = pstmt.executeQuery();
if (rs.next()) {
// if (rs.getInt(1) == 1)
// isid = 1;
isid = rs.getInt(1);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
db.dbClose(rs, pstmt, conn);
}
return isid;
}
idsearch.jsp
<%
String id = request.getParameter("id");
MemberDao dao = new MemberDao();
int count = dao.isIdCheck(id);
JSONObject ob = new JSONObject();
ob.put("count", count);
%>
<%=ob.toString()%>

기존에 insert 했던 id 값인 lululala를 입력하면 count값이 1이 됨 → 아이디 중복
폼 전송 전 작업수행
<form action="member/addaction.jsp" method="post" class="form-inline" onsubmit="return passcheck(this)">
//사용자 정의함수
//비밀번호 틀릴 시 진행x
function passcheck(f) {
if (f.pass.value != f.pass2.value) {
alert("비밀번호가 서로 다릅니다.");
f.pass.value = "";
f.pass2.value = "";
return false; //action 호출 안되도록
}
}
$(function() {
//이메일 선택
$("#selEmail").change(function(){
if($(this).val()=='-'){ //직접입력
$("#email2").val('');
} else{
$("#email2").val($(this).val());
}
})
})
<tr>
<th width="100" bgcolor="#aaa">이메일</th>
<td>
<input type="text" name="email1" class="form-control" required="required" style="width: 120px;" placeholder="이메일 입력">
<b>@</b>
<input type="text" name="email2" id="email2" class="form-control" required="required" style="width: 150px;">
<select id="selEmail" class="form-control">
<option value="-">직접입력</option>
<option value="naver.com">네이버</option>
<option value="gmail.com">구글</option>
<option value="daum.net">다음</option>
<option value="nate.com">네이트</option>
</select>
</td>
</tr>

button → onclick=”delfunc(<%=dto.getNum( )%>)”
<script>
function delfunc(num){
var yes = confirm("정말 강퇴처리 하시겠습니까?");
if(yes) location.href = "member/memberdelete.jsp?num=" + num;
}
</script>