βΆ ν νλ¦Ώ νμ΄μ§λ₯Ό μ¬μ©νλ μ΄μ
ν νλ¦Ώ νμ΄μ§λ λ μ΄μμμ ꡬμ±νκ³ κ° μμμ λ΄μ©μ λ€λ₯Έ νμ΄μ§μμ κ°μ Έμ€λ―λ‘ μ 체 νμ΄μ§ κ΅¬μ± μμ μμλ μ΄ ν νλ¦Ώ νμ΄μ§λ§ λ³νμν€λ©΄ λλ―λ‘ λ§€μ° νΈλ¦¬νλ€.
β
β
β
βΆ ν νλ¦Ώ νμ΄μ§μ μ€κ³
ν νλ¦Ώ νμ΄μ§μ μ€κ³μμ μ€μν κ²μ λ μ΄μμ ꡬ쑰λ₯Ό κ²°μ νλ κ²μ΄λ€. ν νλ¦Ώ νμ΄μ§ μμ²΄κ° λ μ΄μμ ꡬ쑰λ λ§μ°¬κ°μ§μ΄κΈ° λλ¬Έμ΄λ€. ν νλ¦Ώ νμ΄μ§ μ€κ³λ₯Ό μν΄μλ μ¬μ΄νΈ νλ©΄μ νμ΄ κ²°μ λμ΄μΌ νλ€.
β
β
β
βΆ μ‘μ νκ·Έλ₯Ό μ΄μ©ν ν νλ¦Ώ νμ΄μ§μ μμ±
νμΌ μ΄λ¦ |
μ€λͺ |
top.jsp |
νλ©΄ μλ¨μ νμλ λ©λ΄ νμΌ μ΄λ¦μ΄λ€. |
bottom.jsp |
νλ©΄ νλ¨μ νμλ νμΌ μ΄λ¦μ΄λ€. |
left.jsp |
νλ©΄ μ’μΈ‘μ νμλ λ©λ΄ νμΌ μ΄λ¦μ΄λ€. |
newitem.jsp |
μ μν νμ΄μ§ νμΌ μ΄λ¦μ΄λ€. |
bestitem.jsp |
μΈκΈ°μν νμ΄μ§ νμΌ μ΄λ¦μ΄λ€. |
template.jsp |
ν νλ¦Ώ νμ΄μ§(λ μ΄μμ) νμΌ μ΄λ¦μ΄λ€. |
Login.jsp |
λ‘κ·ΈμΈ μ°½μ΄ νμλ νμΌ μ΄λ¦μ΄λ€. |
Join.jsp |
νμκ°μ μ°½μ΄ νμλ νμΌ μ΄λ¦μ΄λ€. |
LoginReg.jsp |
λ‘κ·ΈμΈ μ±κ³΅μ νμλ νμΌ μ΄λ¦μ΄λ€. |
JoinReg.jsp |
νμκ°μ μ νμλ νμΌ μ΄λ¦μ΄λ€. |
Logout.jsp |
λ‘κ·Έμμμ νμλ νμΌ μ΄λ¦μ΄λ€. |
-Login, Join, LoginReg, JoinReg, Logoutμ λ³ΈμΈμ΄ μ§μ λ§λ κ±°,,
μ μλκ»μ μλ°μ€ν¬λ¦½νΈλ‘ μ°λ λ²μ 보μ¬μ£Όμ ¨λλ° μμΌλ‘λ κ³μ λμ¬κ±°λΌκ³ νμ μ λ°λ‘ μ μ§ μμλ€.
β
β
top.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<% String id = (String)session.getAttribute("id"); %>
<% if(id == null) {%>
<a href="template.jsp?page=Login">Login</a>
<a href="template.jsp?page=Join">Join</a>
<% } else { %>
<%=id %> λ νμν©λλ€.
<a href="logout.jsp">Logout</a>
<% } %>
left.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<center>
<a href="./template.jsp?page=newitem">μ μν</a><br><br>
<a href="./template.jsp?page=bestitem">μΈκΈ°μν</a><br><br>
</center>
bottom.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<center>Since 2008</center>
newitem.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<b>μ μν λͺ©λ‘μ
λλ€.</b>
bestitem.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<b>μΈκΈ°μν λͺ©λ‘μ
λλ€.</b>
Login.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action="LoginReg.jsp" method="post">
μμ΄λ : <input type="text" name="id"><br>
λΉλ°λ²νΈ : <input type="text" name="passward"><br>
<input type="submit" value="λ‘κ·ΈμΈ"/>
</form>
</body>
</html>
Join.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<h1>νμ κ°μ
</h1>
<form action="JoinReg.jsp" method="post">
μμ΄λ : <input type="text" name="id"><br>
λΉλ°λ²νΈ : <input type="text" name="passward"><br>
μ΄λ¦ : <input type="text" name="name"><br>
μ νλ²νΈ : <input type="text" name="tel"><br>
<input type="submit" value="νμ κ°μ
" />
</form>
</body>
</html>
LoginReg.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<table>
<tr>
<td><%=request.getParameter("id") %>λ. λ°κ°μ΅λλ€!</td>
</tr>
<a href="template.jsp?page=Logout">Logout</a>
</table>
</body>
</html>
JoinReg.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%request.setCharacterEncoding("UTF-8"); %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<table>
<tr>
<td><%=request.getParameter("name") %>λμ νμκ°μ
μ΄ μλ£λμμ΅λλ€!</td>
</tr>
</table>
</body>
</html>
Logout.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
λ‘κ·Έμμλμμ΅λλ€.
</body>
</html>
template.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
String pagefile=request.getParameter("page");
if (pagefile==null) {pagefile="newitem";}
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Template Test</title>
<style>
table {
margin:auto;
width:960px;
color:gray;
border:1px solid gray;
}
</style>
</head>
<body>
<table border="1">
<tr>
<td height="43" colspan=3 align=left>
<jsp:include page="top.jsp"/>
</td>
</tr>
<tr>
<td width="15%" align=right valign=top><br>
<jsp:include page="left.jsp"/>
</td>
<td colspan=2 align=center>
<jsp:include page='<%=pagefile+".jsp" %>'/>
</td>
</tr>
<tr>
<td width="100%" height="40" colspan="3">
<jsp:include page="bottom.jsp"/>
</td>
</tr>
</table>
</body>
</html>
<μ€ν κ²°κ³Ό>
β
-μ μν,μΈκΈ°μν νμ΄μ§
β
-λ‘κ·ΈμΈ, λ‘κ·Έμμ
β
-νμκ°μ
'JSP' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
[JSP] JSPμμ μλ°λΉ μ¬μ©νκΈ° (0) | 2021.02.24 |
---|---|
[JSP] μλ°λΉ (0) | 2021.02.24 |
[JSP] μ‘μ νκ·Έ (0) | 2021.02.10 |
[JSP] λ΄μ₯ κ°μ²΄μ μ‘μ νκ·Έ - μμ κ°μ²΄μ μμ± (0) | 2021.02.10 |
[JSP] λ΄μ₯ κ°μ²΄μ μ‘μ νκ·Έ - λ΄μ₯ κ°μ²΄ (0) | 2021.02.10 |
λκΈ