【JSP】JSPのFrameから別のFrameにクエリ文字列(Request)のデータを渡すには...

サンプル

index.html

* メイン
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Sample</title>
</head>
<frameset rows="20%,*,20%">
  <frame name="header" scrolling="no" noresize src="./header.html">
  <frameset cols="30%,*">
     <frame name="menu" src="./menu.jsp">
     <frame name="main" src="./main.jsp?Key1=">
  </frameset>
  <frame name="footer" scrolling="no" noresize src="./footer.html">
  <noframes>
   Your browser doesn't support frameset/frame
  </noframes>
</frameset>
</html>

menu.jsp

* ポイントとなるページ(クエリ文字列を渡すページ)
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!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=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<a href="main.jsp?Key=Value1" target="main">main</a><br />
<a href="main2.jsp?Key=Value2" target="main">main2</a><br />
<form name="frm" method="get" action="" target="main">
 <input type="hidden" name="Key" value="Value3">
 <input type="submit" value="main3"
onclick="frm.action='main3.jsp'">
</form>
</body>
</html>

main.jsp

* クエリ文字列を受け取るページ1
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!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=ISO-8859-1">
</head>
<body>
Main<br />
<%
String value = request.getParameter("Key");
%>
Value : <%=value%><br />
<h3>実験用(値を設定してない)</h3>
<a href="main.jsp" target="main">main</a><br />
<a href="main2.jsp" target="main">main2</a><br />
<form name="frm" method="get" action="" target="main">
 <input type="submit" value="main3"
onclick="frm.action='main3.jsp'">
</body>
</html>

main2.jsp

* クエリ文字列を受け取るページ2
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!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=ISO-8859-1">
</head>
<body onload="reloadFrame()">
Main2<br />
<%
String value = request.getParameter("Key");
%>
Value : <%=value%><br />
<h3>実験用(値を設定してない)</h3>
<a href="main.jsp" target="main">main</a><br />
<a href="main2.jsp" target="main">main2</a><br />
<form name="frm" method="get" action="" target="main">
 <input type="submit" value="main3"
onclick="frm.action='main3.jsp'">
</body>
</html>

main3.jsp

* クエリ文字列を受け取るページ3
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!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=ISO-8859-1">
</head>
<body>
Main3<br />
<%
String value = request.getParameter("Key");
%>
Value : <%=value%><br />
<h3>実験用(値を設定してない)</h3>
<a href="main.jsp" target="main">main</a><br />
<a href="main2.jsp" target="main">main2</a><br />
<form name="frm" method="get" action="" target="main">
 <input type="submit" value="main3"
onclick="frm.action='main3.jsp'">
</body>
</html>

header.html

* おまけ:別になくてもいい
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Sample</title>
</head>
<body>
header
</body>
</html>

footer.html

* おまけ:別になくてもいい
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Sample</title>
</head>
<body>
footer
</body>
</html>