SAS 9.1.3 Integration Technologies » SAS Web Infrastructure Kit: Developer's Guide


Developing Custom Portlets
Development Steps
Creating a Deployment Descriptor
Creating Display Resources Files
Developing the Presentation JSP Page
Creating Action Classes
Implementing Portlet Help
Creating a PAR File
Use Cases
Simple Display Portlet
Localized Portlet
Portlet Template (Editable Portlet)
Remote Portlet
Tips and Best Practices
Using the Portlet API
Sample Portlets
Localized Display Portlet (Welcome)
Interactive Form Portlet (FormExample)
Portlet Template, or Editable Portlet (DisplayURL)
Web Application (HelloUserWikExample)
Remote Portlet (HelloUserRemote
Portlet
Sample: Portlet Template, or Editable Portlet (DisplayURL)

Viewer.jsp

The code for Viewer.jsp, which is the presentation component of the DisplayURL portlet, follows.


<!-- Copyright (c) 2003 by SAS Institute Inc., Cary, NC 27513 -->
<%@ page language="java" contentType= "text/html; charset=UTF-8" %>
<%@ page import="com.sas.portal.portlet.PortletContext" %>
<%@ page import="com.sas.portal.portlet.PortletConstants" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c_rt" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt_rt" %>

<%
  PortletContext context = (PortletContext) request.getAttribute(
     PortletConstants.CURRENT_PORTLET_CONTEXT );
  String url = (String) context.getAttribute("sas_DisplayURL_DisplayURL");

  if ((url == null) || (url.length() == 0))
  {
%>
<p style="text-align: center;"><fmt:message key="viewer.nourl.txt"/></p>
<%
  } else {
    try {
%>
<c_rt:import charEncoding="UTF-8" url="<%= url %>" />
<%
    } catch (Exception ex) {
%>
<p style="text-align: center;">
  <fmt_rt:message key="viewer.badurl.fmt">
    <fmt_rt:param value="<%= url %>"/>
    <fmt_rt:param value="<%= ex.getMessage() %>"/>
  </fmt_rt:message>
</p>
<%
    }
  }
%>