WSRP - Open a JSP/Servlet in dialog box from portlet

In the Open a JSP/Servlet in dialog box from portlet entry i talked about how you can open a JSP in dialog box from portlet. I wanted to see if that code will work in WSRP and how it will work so i tried consuming the sample portlet as WSRP portlet and tried clicking on the dialog box and it worked also it was able to pass query parameters.

This is the code in index.jsp that i use for creating URL pointing to popup.jsp

<input type="button" onclick="openPopup('<%=renderResponse.encodeURL(
renderRequest.getContextPath() + "/popup.jsp?userName=poup.jsp") %>')" value="Popup.jsp" />

When i look the HTML generated by this code in the local version of portlet this is what i see

<input type="button" value="Popup.jsp" onclick="openPopup('

In my local the portal the ServletPopup is installed at /wpcert/PA_ServletPopup context so that's what get appended to the URL and the url goes unchanged in renderResponse.encodeURL()

THis markup is generated when i see same portlet in the WSRP world

<input type="button" value="Popup.jsp" onclick="openPopup(

As you can see the renderResponse.encodeURL() method generates a big string starting with /wps/WsrpProxyPortlet/ResourceProxy in the URL, so when you request a JSP the request will first go the consumer portal, there the ResourceProxy portlet will tunnel the request to producer and return the results back

No comments: