Calling the Action class from Configuration.jsp

I defined an action-action class to load the configuration of an existing liferay-portlet.xml based portlet ( liferay-portlet.xml ):

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

This class is the processAction class:

 public class ConfigurationActionImpl extends DefaultConfigurationAction { @Override public void processAction( 

Now I want to add another form with lines (inside the same config.jsp page). Exactly, I want to call another class from all of these lines (calling the 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 can see, the main problem is that actionURL is looking for a configuration-action class, but I definitely want to call the portlet-class function (SelectRules.java) called selectRules.

And the specific selectRules class that I want to call runs as follows:

 public class SelectRuleClass extends MVCPortlet { public void selectRule( PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) 

Do you know what I need to solve this? I do not know how I can combine these two classes with two different extensions, given that configurationActionImpl.java is already defined by another person.

In summary .. I need to call the selectRule function from configuration.jsp, choosing the Rule to be used. But class-action-class is another one needed to load this existing portlet. And when choosing a rule, I get this error ...

 86 does not have any paths specified 

Thank you very much, Oriol

+4
source share
1 answer

Since configuration.jsp displayed by the liferay portlet with the name 86 , you need to use <liferay-portlet:actionURL> instead of the simple <portlet:actionURL> , since you will need to specify the portlet-name whose action method you need to call from configuration.jsp , like that:

 <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 defined <portlet-name>SelectRules</portlet-name> than the portletName attribute of the tag will have the value portletName="SelectRules_WAR_SelectRulesportlet" , this is the identifier of the portlet that liferay generates after deploying the portlet.

This is a convenient way to call one portlet ( SelectRules ) from another ( 86 ).

+5
source

Source: https://habr.com/ru/post/1486195/


All Articles