(3-3 完) [JSP&JDBC] 학생관리 프로그램 만들기 (페이지 이동)

씩씩한 조약돌·2023년 1월 15일
0

미니프로젝트🤹

목록 보기
8/21

list.jsp를 메인페이지로 버튼 추가해주기

1. list.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Student List</title>
<style>
table { border: 2px solid black; border-collapse:collapse; text-align: center;}
th, td { border : 1px solid black; padding :12px;}
th {background-color: skyblue;}
a { display: inline-block;
  border: 1px solid black;
  width: 50px;
  text-decoration: none;
  text-align: center;
  margin-top: 5px;
  border-radius: 10px;
  background-color: white;
  color: #333;}
</style>
</head>
<body>
	<table>
		<tr>
			<th>번호</th><th>이름</th>
			<th>국어</th><th>영어</th><th>수학</th>
		</tr>
	<c:forEach items="${requestScope.aList}" var="dto">
		<tr>
			<td>${dto.num}</td><td>${dto.name}</td>
			<td>${dto.kor}</td><td>${dto.eng}</td><td>${dto.math}</td>
		</tr>
	</c:forEach>
	</table>
	
	<a href="stuinsert">추가</a>
	<a href="stuupdate">수정</a>
	<a href="studelete">삭제</a>
</body>
</html>

2. insert.jsp
3. update.jsp / 4. delete.jsp 도 동일하게 추가

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert</title>
<style>
a { display: inline-block;
  border: 1px solid black;
  width: 100px;
  text-decoration: none;
  text-align: center;
  margin-top: 5px;
  border-radius: 10px;
  background-color: pink;
  color: #333;}
</style>
</head>
<body>

<form action ="stuinsert" method="post">
	<table>
		<tr>
			<th>이름</th><td><input type="text" name="name" /></td>
		</tr>
		
		<tr>
			<th>국어</th><td><input type="text" name="kor" /></td>
		</tr>
		
		<tr>
			<th>영어</th><td><input type="text" name="eng" /></td>
		</tr>
		<tr>
			<th>수학</th><td><input type="text" name="math" /></td>
		</tr>		
		
		<tr>
			<td colspan ="2"><input type="submit" value="저장"></td>
		</tr>
		
	</table>
</form>
<a href="stulist">처음으로</a>
</body>
</html>

최종실행

profile
씩씩하게 공부중 (22.11~)

0개의 댓글