Forums de discussion

Calling a portlet on another 'page' from one portlet

thumbnail
Jakub K B, modifié il y a 14 années.

Calling a portlet on another 'page' from one portlet

Junior Member Publications: 82 Date d'inscription: 12/08/09 Publications récentes
Here is my scenario, I am creating ColdFusion9 Portlets, I have a search portlet on one page (full page portlet, with its own set of functionality / output) with address like /web/guest/search/ and have links from that portlet view load a page that shows /web/guest/item/ABC123 (abc123 being the data being passed to display in the 'more info' portlet). OR at least have the URL look like /web/guest/item?s=ABC123

so on page /web/guest/item I would have a portlet that would handle the URI requested item 'ABC123'.

How can I achieve this inside of a Liferay Coldfusion portlet? I want to keep urls clean so users could potentially bookmark a product they like.

I don't know how to make the url to it, or to read the URL value from a portlet, I have tried vardump'ing #url# but I just get:

struct 
method renderDispatch  


I'm learning as I go with CF9 portlets, as I find that CF9 portlets are limited in documentation.

Thanks, appreciate any input in getting me going on the right path.
thumbnail
Jakub K B, modifié il y a 14 années.

RE: Calling a portlet on another 'page' from one portlet

Junior Member Publications: 82 Date d'inscription: 12/08/09 Publications récentes
Hmm.. nobody? I would figure calling a new page and communicating with another portlet there would be somewhat easy? I just cannot find any documentation...

any way to use createRenderURL() to achieve this?
thumbnail
KK rajput, modifié il y a 14 années.

RE: Calling a portlet on another 'page' from one portlet

Expert Publications: 266 Date d'inscription: 10/04/08 Publications récentes
Hi ,
this is simple just check portletURLImpl.
PortletURLImpl url = new PortletURLImpl(
PortletRequestImpl portletRequestImpl, String portletId, long plid,
String lifecycle)

Eg. In jsp you can use.
PortletURL yourURL = new PortletURLImpl(request, [$your_portlet_id$], [$layout_on_which_portlet_exists$], PortletRequest.RENDER_PHASE);
yourURL.setParameter("struts_action",[$your_portlet_struts_path$]);
yourURL.setWindowState([$desired_window_state$]);
yourURL.setPortletMode([$desired_mode$]);

here data within [$$] is variable.

HTH
KamalKant
thumbnail
Jakub K B, modifié il y a 14 années.

RE: Calling a portlet on another 'page' from one portlet

Junior Member Publications: 82 Date d'inscription: 12/08/09 Publications récentes
Hmm.. that does not seem simple at all ;)
I was looking at just grabbing the URL parameter value

/web/guest/somepage?search=ABC123

search = ABC123

And based on that my portlet can use it.

However I cannot for the life of me GET the url, its like Liferay hides it form the portlet.
Andrew Tillinghast, modifié il y a 14 années.

RE: Calling a portlet on another 'page' from one portlet

Junior Member Publications: 60 Date d'inscription: 05/09/08 Publications récentes
Jakub I gave a full answer in the post Portlet redirect

Basically you want to use the JSR168 methods for setParameter() and getParameter().

There are a number of JSR168/JSR286 tutorials out on the web but a quick one is Resin Portlet Tutorial
thumbnail
KK rajput, modifié il y a 14 années.

RE: Calling a portlet on another 'page' from one portlet

Expert Publications: 266 Date d'inscription: 10/04/08 Publications récentes
If u wanted to go like this then atleast you need to go to that community page where portlet is placed I normally go like this .
StringBuilder sb = new StringBuilder();
sb.append(themeDisplay.getPathFriendlyURLPublic());
sb.append([$friendly url of your group$]);

and append to sb ur data what u want to pass like this
sb.append("?search=ABC123");
in jsp page you can use like this
<a href="<%= sb.toString() %>">click here</a>

HTH
Babu Janarthanan, modifié il y a 14 années.

RE: Calling a portlet on another 'page' from one portlet

Regular Member Publications: 128 Date d'inscription: 31/07/08 Publications récentes
you can try this way to get url parameter using ParamUtil.getString(request, "search"); in your JSP.