1
votes

I use Liferay portlet bundle 6.2 (Tomcat) and Liferay IDE(eclipse). I created an Liferay Plugin Project. I save some data by using Portlet Preferences in this project and I created an button its calls "Search". My question is, how I can invoking an another Liferay Plugin Project, when I press the Button "Search", which is created in this first Liferay Plugin Project? Later I will retrieve this data that I saved by first project from the second Liferay Plugin project.

In follow is the search.jsp, where I created tis Button Search

<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@ taglib uri="http://alloy.liferay.com/tld/aui" prefix="aui" %>
<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %>

<portlet:defineObjects />


<aui:button-row cssClass="guestbook-buttons">

<portlet:renderURL var="addEntryURL">
    <portlet:param name="mvcPath" value="/html/voda/edit_entry.jsp"></portlet:param>
</portlet:renderURL>

<aui:button onClick="<%= addEntryURL.toString() %>" value="Add Entry"></aui:button>

<portlet:renderURL var="showURL">
<portlet:param name="mvcPath" value="/html/voda/show_entries.jsp"></portlet:param>
</portlet:renderURL>

<aui:button onClick="<%= showURL.toString() %>" value="Show"></aui:button>

   <portlet:renderURL var="searchURL">
<portlet:param name="mvcPath" value="/html/voda/search.jsp"></portlet:param>
</portlet:renderURL>

<aui:button onClick="<%= searchURL.toString() %>" value="Search"></aui:button>

1
Can you please elaborate as to what do you mean by invoking another liferay project? Do you mean onclick of button in first portlet you want to fetch data from second portlet and show again in your first portlet? Or you want to show the JSP of second portlet in your first portlet on click of the button? Or is there something else you have in mind. And it would be helpful to know why you would want to do something like this instead of having a single portlet. ThanksPrakash K
I want to show the JSP of second portlet in my first portlet on click of the button. When I deploy both project, I become both in Liferay first page (localhost:8080), but I will show first the first portlet, and when I click on button in first portlet, then It should be go to the jsp of second portlet. I have a new job and I worked as Junior developer, and my chef order me this. I will learn Liferay, it is very important for me. I think this will be a big project and with many tables. An good link, where they explain this is very helpful for me too. Thank youSengül Mor

1 Answers

1
votes

You can refer to this SO answer which shows how to open a second portlet from first portlet in a Pop-up.

The same principles apply, you can just ignore the code for opening the Pop-up.

Here are the main points from the answer (the detail is provided in the answer) which you should consider and ignore other javascript stuff:

  1. You need to create a render-URL in your first portlet with the following attribute portletName="testPopup_WAR_testPopupportlet" replace testPopup_WAR_testPopupportlet with your second portlet's ID.
  2. Give the above link in an anchor tag <a>.
  3. Change the <add-default-resource>true</add-default-resource> in liferay-portlet.xml of your second portlet.
  4. Or if not changes in liferay-portlet.xml then you should have the property portlet.add.default.resource.check.whitelist in portal-ext.properties.

If you want to learn Liferay Portlet Development then the best way to begin is with the book Liferay in Action and Portlets in Action or else start with the new tutorials on Liferay developer Network and then Liferay Developer Guide.

Hope this Helps.