1 year ago

#375681

test-img

Code Master

Popup showing current page instead of new page

I have two JSP files first.jsp and second.jsp. I have loading second.jsp on a popup from first.jsp. I have tried multiple approaches but none of the approaches works. The popup shows current page(first.jsp) instead of showing new jsp page(second.jsp).

My code is

first.jsp

<%@ include file="../init.jsp" %>

<!-- First Approach -->
<portlet:renderURL var="firstApproachURL" windowState="<%= LiferayWindowState.POP_UP.toString() %>">
    <portlet:param name="mvcPath" value="/pages/second.jsp" />
</portlet:renderURL>
<aui:button icon="icon-plus-sign" value="second Page" href="${firstApproachURL}" useDialog="true" />


<!-- Second Approach -->
<liferay-portlet:renderURL var="secondApproachURL" windowState="<%= LiferayWindowState.POP_UP.toString() %>">
    <liferay-portlet:param name="mvcPath" value="/pages/second.jsp" />
</liferay-portlet:renderURL>
<b><a href="javascript: showPopup('<%= secondApproachURL.toString() %>','Second Page',1200,700);" style="text-decoration:none;">
SecondPage Link</a></b>


<!-- Third Approach -->
<portlet:renderURL var="thirdApproachURL" windowState="<%=LiferayWindowState.POP_UP.toString()%>">
    <portlet:param name="mvcPath" value="/pages/second.jsp"/>
</portlet:renderURL>
<aui:button id="popupButton" value="Second Page" />
<aui:script position="inline" use="aui-base">
var popupButton = A.one('#<portlet:namespace />popupButton');
popupButton.on('click',
    function() {
        Liferay.Util.openWindow(
            {
                dialog: {
                    destroyOnHide: true,
                    height: 700,
                    width: 1200
                },
                title: 'Second Page',
                uri: '<%=thirdApproachURL.toString()%>'
            }
        );
    }
);
</aui:script>

second.jsp

<%@ include file="../init.jsp" %>

<h1>This is Second Page</h1>

jsp

liferay

liferay-7

liferay-aui

0 Answers

Your Answer

Accepted video resources