Interstage Portalworks 管理者ガイド
目次 索引 前ページ次ページ

付録F Portletの作成方法について

F.5 シナリオからのPortlet呼出し

Portalworksでは、シナリオからPortletを呼び出すことができます。以下に、Portletを呼び出すシナリオのサンプルを示します。

<%-- ----------------- Active Scenario : PortletCallerScenario ----------------- --%>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="java.util.*" %>
<%@ include file="/scenario/scenarioInit.jsp" %>

<pwst:prologueScenario/>

<%-- Portlet の呼出し --%>
<%
  String   strService; 
  Hashtable   stParam; 

  strService= "Sample";
  request.setAttribute("ServiceName", strService); 
  stParam= new Hashtable();
  stParam.put("TargetPortlet", "Sample");
  stParam.put("PortletMode", "VIEW");
  stParam.put("Invoke", "action");
%>
<pwst:call service="<%=strService%>" type="HTML" paramObject="<%=stParam%>"/>

<pwst:epilogueScenario/>

<jsp:forward page="PortletCallerDoc.jsp"/>

 

<%-- ---------------------- Active Doc : PortletCallerDoc --------------------- --%>
<%@ page contentType="text/html; charset=Shift_JIS" %>
<%@ include file="/scenario/docInit.jsp"%>

<pwst:prologueDoc/>
<pwst:content type="HTML" contentId="PortletCaller"/>

<%-- Portletコンテンツの受け取り --%>
<%
  String   strService; 
  strService = (String) request.getAttribute("ServiceName");
%>
<pwst:receive service="<%=strService%>" result="portletResult" type="HTML" />

<html>
  <body>
    <h1>Portlet 呼出しシナリオ</h1>
    <hr/>
    <table border="1">
      <tr>
        <th>Sample</th>
      </tr>
      <tr>
        <td><%=portletResult.getHtmlContent()%></td>
      </tr>
    </table>
  </body>
</html>

画面出力例

通常の「シナリオ→シナリオ」や「シナリオ→USP」呼出しと同様に、<call>タグ、<receive>タグを利用してPortletを呼び出せます。一回の<call>タグで呼び出されるのは、指定されたPortlet Applicationに含まれる1つのPortletです。

<call>タグのパラメータには、以下を指定できます。

指定方法は、上記Portletを呼び出すシナリオのサンプルの15行目、16行目のように指定します。記述例は、以下のとおりです。

シナリオから<call>タグを利用して呼び出された場合は、パラメータのInvokeの値によって動作を変更できますが、通常のactionを指定している場合は、TargetPortletのprocessActionメソッドとrenderメソッドを順に呼び出して、得られた結果を返します。


シナリオからPortletを呼び出し、ブリック内にそれを表示した場合、Portlet画面内で自Portletを呼び出すリンクは動作しません。自Portletを呼び出すリンクを含むPortletをブリック内に表示する場合は、Portletアプリケーションを直接ロールに割り当ててください。



目次 索引 前ページ次ページ

All Rights Reserved, Copyright(C) 富士通株式会社 2007