51.Struts22008. 12. 15. 15:07
반응형

<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>

<form method="post" action="/strutsboard/insert.no">
 <table align="center">
  <tr>
   <td>작성자<input type="text" name="writer"></td>
  </tr>
  <tr>
   <td>제목<input type="text" name="title"></td>
  </tr>
  <tr>
   <td>내용<input type="text" name="content"></td>
  </tr>
  <tr>
   <td>패스워드<input type="password" name="password"></td>
  </tr>
  <tr>
   <td colspan=2 align="center"><input type="submit" value="save"></td>
   
  </tr>
 </table>
</form>
</body>
</html>


** info.jsp


<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
   
    <%@page import="board.vo.VisitorVO" %>
   
    <%
     VisitorVO vo = (VisitorVO)request.getAttribute("info");
    %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
<script>

 function goDelete(no){
  var dbpassword= document.getElementById("dbpassword").value;
  var userpassword= document.getElementById("password").value;
  if(dbpassword != userpassword){
   alert('비밀번호가 맞지않습니다');
  }else{
   location.href="/strutsboard/delete.no?=no="+no;
 }
 
 function goModify(no){
  var dbpassword= document.getElementById("dbpassword").value;
  var userpassword= document.getElementById("password").value;
  if(dbpassword != userpassword){
   alert('비밀번호가 맞지않습니다');
  }else{
   location.href="/strutsboard/modify.no?no="+no;
  }
 }
 
 
 
</script>


</head>
<body >

<table align="center" cellpadding="1" cellspacing="1" border="1" bordercolor="pink">
 <tr>
  <td bgcolor="pink">글번호</td>
  <td><%=vo.getNo() %>
  <td bgcolor="pink">작성날짜</td>
  <td><%=vo.getRegdate() %></td>
 </tr>
 <tr>
  <td bgcolor="pink">작성자</td>
  <td colspan=3><%=vo.getWriter() %></td>
 </tr>
 <tr>
  <td bgcolor="pink">제목</td>
  <td colspan=3><%=vo.getTitle() %></td>
 </tr>
 <tr>
  <td bgcolor="pink">내용</td>
  <td colspan=3 height="100"><%=vo.getContent() %></td>
 </tr>
 
 <tr>
  <td bgcolor="pink">패스워드</td>
  <td colspan=3><input type="password" id="password" ></td>
  <input type="hidden" id="dbpassword" value="<%=vo.getPassword() %>">
 </tr>
 
 <tr>
  <td colspan=4 align="center">
 <input type="button" value="수정" onclick="location='/strutsboard/modify.no?no=<%=vo.getNo() %>'">
 <input type="button" value="삭제" onclick="location='/strutsboard/delete.no?no=<%=vo.getNo() %>'">
 <input type="button" value="리스트" onclick="location='/strutsboard/list.no'">
 
  </td>
 
 </tr>
</table>
</body>
</html>




** list.jsp



<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
   
   
  <%@page import="board.vo.VisitorVO,java.util.*" %>
 
  <%
   ArrayList list= (ArrayList)request.getAttribute("list");
  %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>

<table align="center" cellspacing="1" border="1" bordercolor="pink">
 <tr>
  <td>글번호</td>
  <td>작성자</td>
  <td>제목</td>
  <td>작성날짜</td>
 </tr>
 
  
 <%
  for(int i=0; i<list.size();i++){
   VisitorVO vo = (VisitorVO)list.get(i);  
 %>
 <tr>
  <td><%=vo.getNo() %></td>
  <td><%=vo.getWriter() %></td>
  <td width=40%><a href="/strutsboard/info.no?no=<%=vo.getNo() %>"><%=vo.getTitle() %></td>
  <td><%=vo.getRegdate() %></td>
 </tr>
 
 <% } %>
 
 <tr>
  <td align="center" colspan=4><input type="button" value="작성하기" onclick="location='/strutsboard/board/write.jsp'"></td>
 </tr>
 
</table>

</body>
</html>





** modifyForm.jsp


<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
    <%@page import="board.vo.VisitorVO" %>
   
    <%
     VisitorVO vo = (VisitorVO)request.getAttribute("info");
    %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>

<table align="center" cellpadding="1" cellspacing="1" border="1" bordercolor="pink">
 
 <input type="hidden" name="no" value="<%=vo.getNo() %>">
 
 <tr>
  <td bgcolor="pink">글번호</td>
  <td><%=vo.getNo() %>
 
  <td bgcolor="pink">작성날짜</td>
  <td><%=vo.getRegdate() %></td>
 </tr>
 <tr>
  <td bgcolor="pink">작성자</td>
  <td colspan=3><input type="text" name="writer" value="<%=vo.getWriter() %>"></td>
 </tr>
 <tr>
  <td bgcolor="pink">제목</td>
  <td colspan=3><input type="text" name="title" value="<%=vo.getTitle() %>"></td>
 </tr>
 <tr>
  <td bgcolor="pink">내용</td>
  <td colspan=3 height="100"><textarea name="content" rows=10><%=vo.getContent() %></textarea></td>
 </tr>
 <tr>
  <td>새 비밀번호</td>
  <td colspan=3><input type="text" name="password"></td>
 </tr>



 <tr>
  <td><input type="button" value="수정" onclick="location='/strutsboard/update.no?no=<%=vo.getNo() %>'">
  <td><input type="button" value="리스트" onclick="location='/strutsboard/list.no'">
 </tr>

</table>
</body>
</html>

Posted by 1010