elObj.jsp
<%@ 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>
<form action="post_elObj.jsp" method="get">
아이디:<input type="text" name="id"/><br/>
비밀번호:<input type="password" name="pw" /><br/>
<input type="submit" value="로그인"/>
</form>
<%
application.setAttribute("appName", "appValue");
session.setAttribute("sessionName", "sessionValue");
pageContext.setAttribute("pageName", "pageValue");
request.setAttribute("reqName", "reqValue");
%>
</body>
</html>
--------------------------------------------------------------------------------------------------------------
post_elObj.jsp
<%@ 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 id1 = request.getParameter("id");
String pw = request.getParameter("pw");
%>
아이디:<%= id1 %> <br/>
비밀번호:<%= pw %> <br/>
<hr />
아이디 : ${param.id}<br/>
비밀번호 : ${param.pw}<br/>
아이디 : ${param["id"]}<br/>
비밀번호 : ${param["pw"]}<br/>
<hr />
applicationScope: ${applicationScope.appName}<br/>
sessionScope: ${sessionScope.sessionName}<br/>
pageScope: ${pageScope.pageName}<br/>
requestScope: ${requestScope.reqName}
<hr/>
- context 초기화 파라미터 <br/>
${initParam.cont_1}<br/>
${initParam.cont_2}<br/>
${initParam.cont_3}
</body>
</html>
-------------------------------------------------------------------------------
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>jsp_Ex_3</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<context-param>
<param-name>cont_1</param-name>
<param-value>강호동</param-value>
</context-param>
<context-param>
<param-name>cont_2</param-name>
<param-value>이경규</param-value>
</context-param>
<context-param>
<param-name>cont_3</param-name>
<param-value>유재석</param-value>
</context-param>
</web-app>
'기존카테고리 > JSP' 카테고리의 다른 글
공지사항 - 파일 쓰기, 읽기 (0) | 2017.06.13 |
---|---|
JSTL (0) | 2017.06.13 |
EL(Expression Language) (0) | 2017.06.13 |
파일업로드 (0) | 2017.06.13 |
[회원가입] 싱글톤 패턴 방식 - 회원입력, ID중복검사 (0) | 2017.06.08 |