JSPAdvertisementresponseオブジェクト、sessionオブジェクト
response:javax.servlet.http.HttpServletResponse のオブジェクト。
session:javax.servlet.http.HttpSession のオブジェクト。 responseオブジェクト、sessionオブジェクトの利用
response.jsp
<%@ page contentType="text/html; charset=Shift_JIS" %>
<meta http-equiv="Content-Type" content="text/html;charset=Shift_JIS">
<html lang="ja">
<head>
<title>テスト</title>
</head>
<body>
<%
// セッションに値を設定
session.setAttribute("Ex", "ABCDE");
// 要求のリダイレクト
response.sendRedirect("./response2.jsp");
%>
</body>
</html>
response2.jsp
<%@ page contentType="text/html; charset=Shift_JIS" %>
<meta http-equiv="Content-Type" content="text/html;charset=Shift_JIS">
<html lang="ja">
<head><title>テスト</title>
</head>
<body>
<%
// セッションから値を取得
String example = (String)session.getAttribute("Ex");
%>
<%-- 表示 --%>
<%= example %>
</body>
</html>
実行結果
ABCDE |