ログインおよびログアウト処理のサンプルを示します。
<%@ page contentType="text/html; charset=Shift_JIS" %>
<%@ taglib uri="http://soft.hitachi.co.jp/portal/urlutils" prefix="uu" %>
<%@ page import="jp.co.hitachi.soft.portal.portlet.PortletUtils" %>
<%@ page import="jp.co.hitachi.soft.portal.portlet.beans.PortletInfoBean" %>
<%!
class SessionListener implements HttpSessionBindingListener {
public void valueBound(HttpSessionBindingEvent e) {
// ログイン時の処理を記述。
}
public void valueUnbound(HttpSessionBindingEvent e) {
// ログアウト時の処理を記述。
}
}
%>
<%
String ns = PortletUtils.getNamespace(request, response);
SessionListener sl = (SessionListener)session.getAttribute(ns+"sl");
if (sl == null) { // 初回アクセス時にセッションリスナを登録
session.setAttribute(ns+"sl", new SessionListener());
}
%>
<jsp:useBean id="pInfo" scope="page"
class="jp.co.hitachi.soft.portal.portlet.beans.PortletInfoBean"/>
<%
pInfo.initBean(request);
PortletInfoBean.Mode mode = pInfo.getMode();
if (mode == PortletInfoBean.Mode.DEFAULT) {
//サマリ画面
} else if (mode == PortletInfoBean.Mode.MAXIMIZE) {
// 最大化画面
} else {
// エラー画面
}
%>