Monday, December 01, 2003

Converting exisitng application to portlets

I would recommend you to call your jsp application from an iframe
portlet. You just need to install the iframe portlet and edit it with the
URL of your jsp app.

Use iframe portlets supplied with IBM Portal Server. Jetspeed pageportlet can also be used.

The example of IFRAME Portlet is as follows -







<%@ page session="false" contentType="text/html"%>

<%@ taglib uri="/WEB-INF/tld/portlet.tld" prefix="portlet" %>

<portlet:init/>

<%

if

(portletRequest.getPortletSettings().getAttribute("iframe.enabled").equalsIgnoreCase("true"))

{ %>

<script type="text/javascript">

var initialUri =

"<portlet:settingsAttribute name='initial.uri'/>"; // sets initial uri

var frameWidth =

"<portlet:settingsAttribute name='frame.width'/>"; // sets frame width

var frameHeight =

"<portlet:settingsAttribute name='frame.height'/>"; // sets frame height

var frameName =

"<portlet:settingsAttribute name='frame.name'/>"; // sets frame name

document.writeln("<iframe

name="+frameName+" src="+initialUri+" frameborder=0 height="+frameHeight+"

width="+frameWidth+">");

// message to be displayed by browser that

does not support iframes

var noIFrameSupportMessage = "<div

class='wpsPortletSmText'>To launch this application in a new window,

please click Login: <a href=" +initialUri+"

target='_blank'>Login</a></div>";

document.write(noIFrameSupportMessage);

document.writeln("</iframe>");

</script>

<% }

else { %>

<script type="text/javascript">

var initialUri =

"<portlet:settingsAttribute name='initial.uri'/>"; // sets initial uri

var frameWidth =

"<portlet:settingsAttribute name='frame.width'/>"; // sets frame width

var frameHeight =

"<portlet:settingsAttribute name='frame.height'/>"; // sets frame height

var frameName =

"<portlet:settingsAttribute name='frame.name'/>"; // sets frame name

var noIFrameSupportMessage = "<div

class='wpsPortletSmText'>To launch this application in a new window,

please click Login: <a href=" +initialUri+"

target='_blank'>Login</div></a></div>";

document.write(noIFrameSupportMessage);

</script>

<% } %>

Sample, modify as you will. You can use the JSPPortlet to call out to the jsp page.


You can get more detail of IFRAME related to Portlets from - Search IFRAME in deja


"Converting an existing application to a portlet" section of this article can also help.

Please let me know about more resources on this subject.
You will find other techniques like wrapping and Native portlets in the article.


Note: Most of the ideas are IBM Portal Server compatible. But I guess, it must work on other servers too.

4 comments:

  1. GUD but can u give me more detailed description of IFRAME portlet

    ReplyDelete
  2. can we use existing PHP web site in an iframe portlet? ( or can we use PHP site in a portal container using any other portlet method)?

    ReplyDelete
  3. MaNJuLA, IFrame and WebClipping seems two possible methods in your case. --Punit

    ReplyDelete
  4. Hi Punit,
    I am curious to understand the IFrame approach you're talking about. I have a customer who has rich content-management functionality (CMS) - Sharepoint-like website. I am evaluating if that functionality can be integrated to our home-grown 'collaboration' application running on Liferay container. Would Iframe be a good candidate in this case. From what I understand, IFrame approach purely from a 'HTML' perspective can only provide multiple view points for a specific web-content (render only static content). Can you please advice?

    Thanks
    Sri

    ReplyDelete