■struts-config.xmlのAction設定
<!-- Action -->
<action-mappings>
<!-- Login -->
<action path="/LoginBefore" type="login.LoginBefore">
<forward name="success" path="/JSP/LoginBefore.jsp" />
</action>
<action path="/LoginAfter" type="login.LoginAfter">
<forward name="success" path="/JSP/LoginAfter.jsp" />
</action>
<action path="/F2Before" type="login.F2Before">
<forward name="success" path="/JSP/F2_before.jsp" />
</action>
<action path="/F2After" type="login.F2After">
<forward name="success" path="/JSP/F2_after.jsp" />
</action>
</action-mappings>
■ログイン前の画面(LoginBefore.jsp)
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<html:html>
<head>
<script type="text/javascript" src="JSP/prototype.js"></script>
<script type="text/javascript">
<!--
window.onload=init;
function init()
{
var url = 'http://localhost:8080/Test/F2Before.do';
var myAjax = new Ajax.Updater
(
'F1',
url,
{
method: 'post',
}
);
}
-->
</script>
</head>
<body>
<div id="F1"></div>
<div id="F2">
<html:link action="LoginAfter">login</html:link>
<div id="subWindow"></div>
</div>
</body>
</html:html>
■ログイン後の画面(LoginAfter.jsp)
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<html:html>
<head>
<script type="text/javascript" src="JSP/prototype.js"></script>
<script type="text/javascript">
<!--
window.onload=init;
function init()
{
var url = 'http://localhost:8080/Test/F2After.do';
var myAjax = new Ajax.Updater
(
'F1',
url,
{
method: 'post',
}
);
}
-->
</script>
</head>
<body>
<div id="F1"></div>
<div id="F2">
Login OK
</div>
</body>
</html:html>
■ログイン前に表示したいページ(F2_before.jsp)
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<iframe src="http://www.google.co.jp/webhp?hl=ja" height=200 width=1000>
この部分は iframe 対応のブラウザで見てください。
</iframe>
■ログイン後に表示したいページ(F2_after.jsp)
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<iframe src="http://www.yahoo.co.jp" height=200 width=1000>
この部分は iframe 対応のブラウザで見てください。
</iframe>
|