How to open a portal page in dialog box

In the Opening a popup inside portlet, i built a sample portlet that will open www.google.com in a popup dialog box, but most probably you will want to open another portal page in dialog box.

You can do that by creating a URL mapping to the portal page that you want to open in popup dialog box. In my local environment i have a portal page at /wpcert/mydemo/jmeter1 URL, that i wanted to open in popup dialog box, so i changed my JSP like this


<%@page language="java" contentType="text/html; %>
<%@taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" 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) {
window.showModalDialog(popupUrl,"name","dialogWidth:255px;dialogHeight:250px");
} else {
window.open(popupUrl,'name',
'height=500,width=500,toolbar=no,directories=no,status=no,menubar=no,
scrollbars=no,resizable=no ,modal=yes');
}
}
//-->
</script>



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


And now this is how my portal page popup dialog box looks like




If you dont want to create all the URL mappings upfront then you can also use Portal URL generation service for creating URL to the portal page, i might blog about sample portlet :)

4 comments:

Ramesh K said...

Thanks for sharing this informative information..
For Storm components all over information you may also refer.... http://www.s4techno.com/blog/2016/08/13/storm-components/

srjwebsolutions said...

We are leading responsive website designing and development company in Noida.
We are offering mobile friendly responsive website designing, website development, e-commerce website, seo service and sem services in Noida.

Responsive Website Designing Company in Noida
Website Designing Company in Noida
SEO Services in Noida
SMO Services in Noida

Vikas Chaudhary said...

Battery Mantra is Authorized exide car battery dealer in Noida and Greater Noida. We are providing our service in Indirapuram, Delhi, Ashok Nagar.

Exide Battery Dealer in Noida
Battery Dealer in Noida
Authorized Battery Dealer in Noida
Car Battery Dealer in Noida
Car Battery Dealer
Exide Battery Dealer

EG MEDI said...

Egmedi.com is online medical store pharmacy in laxmi nagar Delhi. You can Order prescription/OTC medicines online.
Cash on Delivery available. Free Home Delivery


Online Pharmacy in Delhi
Buy Online medicine in Delhi
Online Pharmacy in laxmi nagar
Buy Online medicine in laxmi nagar
Onine Medical Store in Delhi
Online Medical store in laxmi nagar
Online medicine store in delhi
online medicine store in laxmi nagar
Purchase Medicine Online
Online Pharmacy India
Online Medical Store