4

I have defined a configuration-action-class for loading the configuration of an existing portlet based on drools (liferay-portlet.xml):

<configuration-action-class>com.liferay.drools.action.ConfigurationActionImpl</configuration-action-class>

This class is processAction class:

public class ConfigurationActionImpl extends DefaultConfigurationAction {

    @Override
    public void processAction(

Now, I want to add another form with rows (inside the same config.jsp page). Exactly I want to call a different class from all of this rows (A call to SelectRules.java class):

<%
ResultRow row = (ResultRow)request.getAttribute(WebKeys.SEARCH_CONTAINER_RESULT_ROW);
IRRule myRule = (IRRule)row.getObject();
String name = IRRule.class.getName();
String primKey = String.valueOf(myRule.getPrimaryKey());
%>

<liferay-ui:icon-menu>
    <portlet:actionURL name="selectRule" var="selectURL">
        <portlet:param name="resourcePrimKey" value="<%=primKey %>" />
    </portlet:actionURL>
    <liferay-ui:icon image="checked" message="SelectRule" url="<%=selectURL.toString() %>" />
</liferay-ui:icon-menu>

In my portlet.xml I defined the following portlet-class:

<portlet-class>com.myown.oriol.selectrules.portlet.SelectRules</portlet-class>

As you see, the main problem is that actionURL is looking to the configuration-action-class but what I exactly want is to call to the portlet-class(SelectRules.java) function called selectRules.

And the defined class selectRules that I want to call starts this way:

public class SelectRuleClass extends MVCPortlet {

    public void selectRule(
            PortletConfig portletConfig, ActionRequest actionRequest,
            ActionResponse actionResponse)

Do you know what I need to solve this?? I don't know how I can merge this two classes with two different extensions considering that configurationActionImpl.java is already defined by another person.

In resume.. I need to call the function selectRule from configuration.jsp while selecting a Rule to be used. But the configuration-action-class is another one required for loading this existing portlet. And while selecting a rule I get this error...

86 does not have any paths specified

Thank you so much, Oriol

user1592470
  • 401
  • 2
  • 8
  • 21
  • Not clear - what you exactly want to do and what is not working which needs a solution? – Prakash K Jun 14 '13 at 10:44
  • I need to call the function selectRule from configuration.jsp. But the configuration-action-class is another one required for loading this portlet. And I get this error while selecting a rule... 86 does not have any paths specified – user1592470 Jun 14 '13 at 11:07

1 Answers1

5

Since the configuration.jsp is rendered by a liferay portlet with name 86 you would need to use <liferay-portlet:actionURL> instead of the simple <portlet:actionURL> since you would need to specify the portlet-name whose action method you need to call from configuration.jsp, something like this:

<liferay-ui:icon-menu>
    <liferay-portlet:actionURL name="selectRule" var="selectURL" portletName="SelectRules_WAR_SelectRulesportlet">
        <liferay-portlet:param name="resourcePrimKey" value="<%=primKey %>" />
    </liferay-portlet:actionURL>
</liferay-ui:icon-menu>

If you have defined <portlet-name>SelectRules</portlet-name> than the attribute portletName of the tag would have value portletName="SelectRules_WAR_SelectRulesportlet", this is the portlet-id which is generated by liferay once you deploy the portlet.

This is liferay's convenient way to call one portlet (SelectRules) from another (86).

Prakash K
  • 11,669
  • 6
  • 51
  • 109
  • Thank you for the help! But I made a mistake on naming, SelectRulesPortlet is a class from the same Portlet (All of the code I placed here is from the same portlet). The same portlet I'm executing have the SelectRulesPortlet class and the ConfigurationActionImpl class. Maybe if I put the SelectRulesPortlet class in another Portlet this will function, but It doesn't seems to be the best solution. Do you have any other idea? – user1592470 Jun 14 '13 at 15:05
  • How can two portlets have the same class? Or I think you mean same project (single WAR) having 2 portlets? i have already explained that `86` is a liferay portlet so whether you put the portlet in the same WAR or any other WAR it makes no difference in the solution. Still you can wait for some Liferay Expert to give the best solution, that would help me as well. Thanks – Prakash K Jun 17 '13 at 06:32
  • Same project, having 2 classes, 1 portlet. One view.jsp, one config.jsp. From config.jsp one call to the ConfigurationActionImpl class and another to SelectRules call. I'll continue looking at this. – user1592470 Jun 17 '13 at 07:32
  • Finally I solved the problem using your liferay-portlet:actionURL tag and a correct implementation of the processAction function class looking at the definition of ConfigurationAction class, thank you so much! – user1592470 Jun 17 '13 at 13:19