----- HEADER

<%@ page contentType="text/html; charset=EUC-KR" pageEncoding="EUC-KR"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<fmt:requestEncoding value="EUC_KR"/>
<h1> 헤더 정보들 </h1>
<c:forEach var="h" items="${header }">
<li><c:out value="${h.key }"/>:
<c:out value="${h.value }"/>:
</c:forEach>
<p/>
<c:out value="${param.name }"/>

-- 사진
 


----- 구구단

<%@ page contentType="text/html; charset=EUC-KR" pageEncoding="EUC-KR"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%
String t; // t가  <c:set var="t" value="${param.t }"/>부분과 동일
t = request.getParameter("t");
%>
<center>
<h1> 구구단 </h1>
<c:set var="t" value="${param.t }"/>
<c:if test="${empty t }"> <%// if문 t가 비어있따면 %>
<c:set var="t" value="5"/> <%// t가 5로 되어라 %>
</c:if>
<%//for문 int a = 1;    i<9       i++ %>
<c:forEach var="a" begin="1" end="9" step="1">
<c:out value="${t } * "/> <%//System.out.println(t); 동일 %>
<c:out value="${a } "/>=<c:out value=" ${t * a}"/><br>
</c:forEach>
</center>


-- 결과 구구단의 5단이 출력된다, t=5이기 때문이다.

---- 전송 - 빈이용


-- ContacInfo.java (빈즈역할)
package el;

public class ContacInfo {
private String name;
private String email;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}


 -- contact4.html

<html><head><title>연락처</title></head>
<body>
<h3>연락처</h3>
<form method=post action=contact4.jsp>
이름 <input type=text name="name"><br>
메일 <input type=text name="email"> <br>
<p>
<input type=submit value=전송>
<input type=reset value=취소>
</form>
</body>
</html>

 -- contact4.jsp

 
<%@ page contentType="text/html; charset=EUC-KR" pageEncoding="EUC-KR"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<fmt:requestEncoding value="EUC_KR"/>
<jsp:useBean id="info" class="el.ContacInfo" scope="session"/>
<jsp:setProperty property="*" name="info"/>
이름 : ${info.name }<br/>
이메일 : ${info.email }<br/>

 -- 사진

 












+ Recent posts