Opening a popup inside portlet

Opening a dialog box from portlet is one of the uncommon requirements, but i wanted to try that. Basic idea is opening a dialog box from portlet is normal as opening it from any other web application, but the problem is when you want to open a dialog box from any other web application.

I built this sample portlet which opens in the dialog box like this

Inside the doView() method of the portlet i am forwarding control to index.jsp which is like this

<%@page language="java" contentType="text/html; %>
<%@taglib uri="" prefix="portlet"%>
<%@ taglib uri="" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/portal.tld" prefix="portal" %>

<portlet:defineObjects />
<h3>Popup portlet</h3>

<script type="text/javascript">
function openPopup(popupUrl){
if (window.showModalDialog) {
} else {,'name',
status=no,menubar=no,scrollbars=no,resizable=no ,modal=yes');

<input type="button" onclick="openPopup('')"
label="Open popup" value="Open Popup" />

When user clicks on Open popup button i am calling openPopup() method in JavaScript which takes care of opening popup

No comments: