JSP| EL (Experession Language)

kji306301·2022년 4월 19일
0

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


<!-- MemberInfo클래스를 자바빈으로 사용 vpdlwldptj tkdydgkrpTek -->
<jsp:useBean id="member" class="com.javalec.ex.MemberInfo" scope="page" />


<!-- 자바빈 사요 액션태그: 데이터 입력 -->
<jsp:setProperty name="member" property="name" value="홍길동" />
<jsp:setProperty name="member" property="id" value="abc" />
<jsp:setProperty name="member" property="pw" value="123" />


<!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>

	<!-- 자바빈 출력 -->
	이름 :
	<jsp:getProperty name="member" property="name" /><br /> 아이디 :
	<jsp:getProperty name="member" property="id" /><br /> 비밀번호 :
	<jsp:getProperty name="member" property="pw" /><br />

	<hr />

	<!-- EL 표기법 출력 -->
	이름 : ${member.name }
	<br /> 아이디 : ${member.id }
	<br /> 비밀번호 : ${member.pw }
	<br />

</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>

	<form action="objelOk.jsp" method="get">
		아이디 : <input type="text" name="id"><br /> 비밀번호 : <input
			type="password" name="pw"> <input type="submit" value="login">
	</form>

	<%
	//객체에 네임과 밸류 지정 
	application.setAttribute("application_name", "application_value");
	session.setAttribute("session_name", "session_value");
	pageContext.setAttribute("page_name", "page_value");
	request.setAttribute("request_name", "request_value");
	%>

</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("id");
		String pw = request.getParameter("pw");
	%>
	
	아이디 : <%= id %> <br />
	비밀번호 : <%= pw %>
	
	<hr />
	
	<!-- EL표기 -->
	아이디 : ${ param.id } <br />
	비밀번호 : ${ param.pw } <br />
	
	<!-- 위와 같은 내용 -->
	아이디 : ${ param["id"] } <br />
	비밀번호 : ${ param["pw"] }
	
	<hr />
	
	applicationScope : ${ applicationScope.application_name }<br />
	sessionScope : ${ sessionScope.session_name }<br />
	pageScope : ${ pageScope.page_name }<br />
	requestScope : ${ requestScope.request_name }
	
	<hr/>
	
	context 초기화 파라미터<br />
	${ initParam.con_name } <br />
	${ initParam.con_id } <br />
	${ initParam.con_pw } <br />
</body>
</html>
<?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_23_3_ex1_elex</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>con_name</param-name>
  	<param-value>con_name은 홍길동 입니다.</param-value>
  </context-param>
  <context-param>
  	<param-name>con_id</param-name>
  	<param-value>con_id는 abcde 입니다.</param-value>
  </context-param>
  <context-param>
  	<param-name>con_pw</param-name>
  	<param-value>con_pw는 12345 입니다.</param-value>
  </context-param>
  
</web-app>
profile
come on harry we wanna say goodnight to you

0개의 댓글