상세 컨텐츠

본문 제목

jsp 답변형 게시판, 오라클 사용, 막코딩...action부분

관리X 과거글

by 까먹기전에 2015. 2. 17. 17:24

본문

반응형







==============================================================

<%@page import="sun.reflect.ReflectionFactory.GetReflectionFactoryAction"%>

<%@ page language="java" contentType="text/html; charset=EUC-KR"

    pageEncoding="EUC-KR"%>

    <jsp:useBean id="dao" class="board.MemberDAO" />

<jsp:useBean id="vo" class="board.MemberVO" />

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">

<title>Insert title here</title>

</head>

<body>

<%

request.setCharacterEncoding("euc-kr");

String id = request.getParameter("id");

String rst=dao.chkid(id);

%>

<%if(!id.matches("[a-zA-Z0-9가-힝]{3,7}")){%>

<script type="text/javascript">

alert("특문 이나 ㄱ한자1번 쓰지마시고 아이디 3~7글자 하셈, 이경민님?");

history.go(-1);

</script>

<%} 

else if(id.equals(rst)){%>

<script type="text/javascript">

alert("이미있어요 딴거하셈");

history.go(-1);

</script>

<%}else{ 

request.setAttribute("thisid", id); //되는 아이디를 저장

%>

<script type="text/javascript">

alert("이걸로 해도되용");

</script>

<a href="../form/joinForm.jsp" name="thisid"><%=id%>로 결정</a>

<% }%>


</body>

</html>

=====================================================================

<%@ page language="java" contentType="text/html; charset=EUC-KR"

    pageEncoding="EUC-KR"%>

<%@ page import="board.*" %>

<jsp:useBean id="dao" class="board.MemberDAO" />

<jsp:useBean id="vo" class="board.MemberVO" />



<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">

<title></title>

</head>

<body>

<%

request.setCharacterEncoding("euc-kr");

String seq=(String)request.getParameter("seq");

String id=(String)session.getAttribute("login1");

String comment=(String)request.getParameter("comment");

int rst=dao.comment(seq,id,comment);

if(rst!=0){

session.setAttribute("seq", seq);%>

<script type="text/javascript">

alert("댓글저장성공");

location.href="viewgleAction.jsp";

</script>

<%}else{ %>

<script type="text/javascript">

alert("댓글저장실패요;;");

</script>

<%}

%>

</body>

</html>

==========================================================================

<%@ page language="java" contentType="text/html; charset=EUC-KR"

    pageEncoding="EUC-KR"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">

<title>Insert title here</title>

</head>

<body>

<%

String id=request.getParameter("findid");

%>

</body>

</html>

------------------------------------------------------------------------

<%@ page language="java" contentType="text/html; charset=EUC-KR"

    pageEncoding="EUC-KR"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">

<title>Insert title here</title>

</head>

<body>

<%

String pw=request.getParameter("findpw");

%>

</body>

</html>

------------------------------------------------------------------------------

<%@ page language="java" contentType="text/html; charset=EUC-KR"

pageEncoding="EUC-KR"%>

<%@ page import="java.util.*"%>

<%@ page import="board.*"%>

<jsp:useBean id="dao" class="board.MemberDAO" />

<jsp:useBean id="vo" class="board.MemberVO" />

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%

request.setCharacterEncoding("euc-kr");

int first;

int last;

int row=dao.totalrow();

try{

first=Integer.parseInt(request.getParameter("first"));

last=Integer.parseInt(request.getParameter("last"));

}

catch(Exception e){

first=1;

last=20;

}

ArrayList<MemberVO> list = dao.totalgle(first,row);

%>

<html>

<head>


<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">

<title>게시글 뿌리기 액션</title>

</head>


<body>


<form action="viewgleForm.jsp" method="post">

<%for(MemberVO mem : list){%>



<tr>

<td id="no" align="center"><%=mem.getSeq()%></td>


<td class="je"><a

href="../action/viewgleAction.jsp?no=<%=mem.getSeq()%>" name="vie"

onclick="viewgle(this)"><%=mem.getJe()%></a></td>

<td class="writer"><%=mem.getId()%></td>


<td class="writedate"><%=mem.getWritedate()%></td>


<td class="count"><%=mem.getJo()%></td>

</tr>



<%}%>

</form>


</body>

</html>

===================================================================================

<%@ page language="java" contentType="text/html; charset=EUC-KR"

pageEncoding="EUC-KR"%>

<jsp:useBean id="dao" class="board.MemberDAO" />

<jsp:useBean id="vo" class="board.MemberVO" />


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">

<title>조인액션</title>

</head>

<body>

<%

request.setCharacterEncoding("euc-kr");

int rst=0;

String id=(String)request.getParameter("joinid").trim();

String pw=(String)request.getParameter("joinpw").trim();

String addr=(String)request.getParameter("joinaddr").trim();

String tel=(String)request.getParameter("jointel").trim();

String email=(String)request.getParameter("joinemail").trim();

vo.setId(id);

vo.setPw(pw);

vo.setAddr(addr);

vo.setTel(tel);

vo.setEmail(email);

rst=dao.insertMember(vo);

%>


<%if(rst==0){%>

<script>

alert("회원가입 실패");

history.go(-1);

</script>

<%}else if(rst>0){%>

<script>

alert("회원가입 성공!");

location.href="../form/BoardForm.jsp";

</script>


<%

session.setAttribute("login1", id) ;

} %>


</body>

</html>

===============================================================================================

<%@ page language="java" contentType="text/html; charset=EUC-KR"

pageEncoding="EUC-KR"%>

<jsp:useBean id="dao" class="board.MemberDAO" />

<jsp:useBean id="vo" class="board.MemberVO" />


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">




<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">

<title>로그인 액션</title>

</head>

<body>


<%

request.setCharacterEncoding("euc-kr");

String id =(String)request.getParameter("id");

String pw =(String)request.getParameter("pw");

int rst=dao.loginCheck(id,pw);

if(rst==2){%>


<script> 

alert(" 로그인 성공! 얏호! 환영합니다")

location.href="../form/BoardForm.jsp";

</script>

<%

session.removeAttribute("login1");

session.setAttribute("login1", id);

}else{ %>

<script> 

alert("아이디 혹은 비밀번호가 틀려버렸어!");

history.go(-1);

</script>

<%} %>

</body>

</html>

=============================================================================================

<%@page import="java.util.ArrayList"%>

<%@page import="board.*" %>

<%@ page language="java" contentType="text/html; charset=EUC-KR"

    pageEncoding="EUC-KR"%>

<jsp:useBean id="dao" class="board.MemberDAO" />

<jsp:useBean id="vo" class="board.MemberVO" />

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">

<title>Insert title here</title>

</head>

<body>

<%

String myid=(String)session.getAttribute("login1");

ArrayList<MemberVO> d = dao.mygle(myid);

%>

<form action="viewgleForm.jsp" method="post">

<%for(MemberVO mem : d){%>


<tr>

<td id="no" align="center"><%=mem.getSeq()%></td>


<td class="je"><a

href="../action/viewgleAction.jsp?no=<%=mem.getSeq()%>" name="vie"

onclick="viewgle(this)"><%=mem.getJe()%></a></td>

<td class="writer"><%=mem.getId()%></td>


<td class="writedate"><%=mem.getWritedate()%></td>


<td class="count"><%=mem.getJo()%></td>

</tr>



<%}

response.sendRedirect("../form/BoardForm.jsp?mygle=../action/mygleAction.jsp");%>

</form>

</body>

</html>

===========================================================================================================

<%@page import="com.sun.xml.internal.bind.v2.runtime.Location"%>

<%@page import="java.util.ArrayList"%>

<%@ page language="java" contentType="text/html; charset=EUC-KR"

    pageEncoding="EUC-KR"%>

<%@ page import="board.*" %>

    <jsp:useBean id="dao" class="board.MemberDAO" />

<jsp:useBean id="vo" class="board.MemberVO" />

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">

<title></title>

</head>

<body>

<%

request.setCharacterEncoding("euc-kr");

String title = (String)request.getParameter("no");

if(title==null){

title=(String)session.getAttribute("seq");

}

ArrayList<MemberVO> list=dao.viewgle(title);

ArrayList<MemberVO> list2=dao.viewgleCom(title);

if(list2!=null){

session.setAttribute("bolglecom", list2);

}

if(list!=null){

session.setAttribute("bolgle", list.get(0));

dao.jo(list.get(0).getSeq());

response.sendRedirect("../form/viewgleForm.jsp");

}

else{

%>

<script type="text/javascript">

alert("글 불러오기 실패");

history.go(-1);

</script>

<%} %>


</body>

</html>

==================================================================================================

<%@ page language="java" contentType="text/html; charset=EUC-KR"

pageEncoding="EUC-KR"%>

<%@ page import="board.*" %>

<jsp:useBean id="dao" class="board.MemberDAO" />



<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%

request.setCharacterEncoding("euc-kr");

int rst=0;

MemberVO vo = new MemberVO();

String id=(String)session.getAttribute("login1");

String ti=(String)request.getParameter("wpahr"); // 제목

out.println(ti);

String na=(String)request.getParameter("sodyd"); //글쓴내용

vo.setId(id);

vo.setJe(ti);

vo.setNa(na);

rst=dao.gle(vo);

%>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">

<title>디비에 글쓴거 저장하기</title>

</head>


<%if(rst==0){ %>

<script type="text/javascript">

alert("글쓰기 저장 실패");

location.href="../form/writeForm.jsp";

</script>

<%} else{ %>

<script type="text/javascript">

location.href="../form/BoardForm.jsp";

</script>

<%} %>

<body>



</body>

</html>

관련글 더보기