掲示板

Prime faces action listeners not getting invoked

9年前 に Rajesha Indurthi によって更新されました。

Prime faces action listeners not getting invoked

New Member 投稿: 7 参加年月日: 13/10/01 最新の投稿
Hi,
Iam using liferay version 6.2.0-ce-ga1 , I have a JSF portlet on it and Iam using primefaces version 3.5 with the JSF. I am using a portlet bridge to build the application(portlet). I am seeing that action listener on primefaces menu item, commandlink and command buttons are not getting invoked intermittently. What may be the problem. Is there a race condition , or is it possible that the request/response lifecycle of the portlet bridge is interfering with the way the action listeners should work with these prime faces components. I thank you in advance for the help.


Rajesh.
thumbnail
9年前 に Juan Gonzalez によって更新されました。

RE: Prime faces action listeners not getting invoked

Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿
Can you post snippets from the managed bean and xhtml?

Thanks.
9年前 に Rajesha Indurthi によって更新されました。

RE: Prime faces action listeners not getting invoked

New Member 投稿: 7 参加年月日: 13/10/01 最新の投稿
Sorry on the earlier post I dont have the whole code

XHTML snippet, please notice that the code which is bolded has the p:commandLink which Iam trying to call. line # 55-60

<p:datatable id="projectsDataTable" var="projectDescription" styleclass="dataTable" value="#{cc.attrs.projectsToDisplay}" paginator="true" rows="10" paginatortemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {CurrentPageReport} {RowsPerPageDropdown}" paginatorposition="top" rowsperpagetemplate="#{msgs['projectManagement.projectsTable.rowsPerPageTemplate']}" widgetvar="projectsTable" filteredvalue="#{projectManagementBean.filteredProjectViews}">
				<f:facet name="header">
					<p:outputpanel styleclass="paginatedDataTableFilter">
						<h:outputtext value="#{cc.attrs.title}: #{fn:length(cc.attrs.projectsToDisplay)} " />
						<h:outputtext value="| #{msgs['projectManagement.projectsTable.filter']} #{cc.attrs.elementName} #{msgs['projectManagement.projectsTable.name']}: " />
						<p:inputtext id="globalFilter" onkeyup="projectsTable.filter()" onfocus="projectsTable.clearFilters()" styleClass="ic-global-filter-input" />
					</p:outputpanel>
				</f:facet>
				<p:column headertext="#{cc.attrs.elementName} #{msgs['projectManagement.projectsTable.name']}" filterby="#{projectDescription.projectName}" filtermatchmode="contains" filterstyle="display:none" sortby="#{projectDescription.projectName}">
					<h:outputtext value="#{projectDescription.projectName}" styleClass="projectName" />
					<project:projectmanagementactionsmenu id="projectManagementActionsMenu" elementName="#{cc.attrs.elementName}" projectName="#{projectDescription.projectName}" projectDescription="#{projectDescription}" />
				</p:column>
				<p:column id="baselineName2" rendered="#{not (cc.attrs.elementName == 'Library')}" headertext="#{msgs['projectManagement.projectsTable.baseline']}" sortby="#{projectDescription.baselineName}">
					<h:outputtext id="baselineName" value="#{projectDescription.baselineName}" />
				</p:column>
				<p:column headertext="#{msgs['projectManagement.projectsTable.lastModifiedBy']}">
					
					<h:outputtext value="system" />
					
				</p:column>
				<p:column headertext="#{msgs['projectManagement.projectsTable.dateModified']}" sortby="#{projectDescription.selectedBaseLineDescription.lastModifiedDate}">
					<h:outputtext value="#{projectManagementBean.currentDate}">
						<f:convertdatetime pattern="MM/dd/yyyy hh:mm a" />
					</h:outputtext>
					
				</p:column>
				[b]<p:column headertext="test">
					<p:commandlink actionlistener="#{projectManagementBean.setTest}">
					<h:outputtext value="test" />
					</p:commandlink>
				</p:column>[/b]
			</p:datatable>


My managed bean backing bean code


	public void setTest(String test)
	{
		this.test = test;
	}


Iam also using this extension in the faces-config

<factory>
		<factory-extension>
			<bridge:bridge-context-factory>com.equifax.ic.analytics.liferay.wrappers.BridgeContextFactoryCustomImpl</bridge:bridge-context-factory>
		</factory-extension>
	</factory>


Code for the above class

	@Override
	public BridgeContext getBridgeContext(BridgeConfig bridgeConfig, BridgeRequestScope bridgeRequestScope, PortletConfig portletConfig, PortletContext portletContext,
			PortletRequest portletRequest, PortletResponse portletResponse, PortletPhase portletPhase, PortletContainer portletContainer, IncongruityContext incongruityContext)
			throws FacesException
	{
		BridgeContext wrappedBridgeContext = wrappedBridgeContextFactory.getBridgeContext(bridgeConfig, bridgeRequestScope,
				portletConfig, portletContext, portletRequest, portletResponse, portletPhase, portletContainer, incongruityContext);

		BridgeContext bridgeContext = new BridgeContextCustomImpl(wrappedBridgeContext);

		return bridgeContext;
	}


code for the BridgeContextCustomImpl

private static final String ANAV = "anav";

	private final BridgeContext wrappedBridgeContext;

	public BridgeContextCustomImpl(BridgeContext bridgeContext)
	{
		this.wrappedBridgeContext = bridgeContext;
		BridgeContext.setCurrentInstance(this);
	}

	@Override
	public String getResponseNamespace()
	{
		return ANAV;
	}

	@Override
	public BridgeContext getWrapped()
	{
		return wrappedBridgeContext;
	}
thumbnail
9年前 に Juan Gonzalez によって更新されました。

RE: Prime faces action listeners not getting invoked

Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿
Hi Rajesha,

wow, did you think without that code we could guess what was happening? emoticon

Without digging into your custom Bridge impl, I see your action listener backing bean method doesn't use a more typical method signature:


 public void setTest(ActionEvent testEvent)
    {
         this.test = (String) testEvent.getComponent().getAttributes().get("param");
    }


and :

<p:commandlink actionlistener="#{requestBean.setTest}">
				<f:attribute name="param" value="test" />	
</p:commandlink>


Maybe the issue is there.
9年前 に Rajesha Indurthi によって更新されました。

RE: Prime faces action listeners not getting invoked

New Member 投稿: 7 参加年月日: 13/10/01 最新の投稿
Hi Juan,
If we can fix this issue for me , then absolutely you are my magician.. in the good spirit. the snippet which I pasted was just the test call , I also used the action listeners in the typical format like below and the actiolistener are not getting invoked

<p:menuitem id="copyBaseLine" value="#{msgs['projectManagementActionsMenu.copyBaseline']}" rendered="#{sec:areAllGranted('USER') and (not (cc.attrs.elementName == 'Library'))}" oncomplete="openDialogCleaningUpForm('copyBaselineForm',copyBaseline)" actionlistener="#{projectManagementBean.onResetCopyBaselineInfo}" immediate="true" update=":copyBaselineForm" icon="ui-icon-document">
				<f:attribute name="projectWrapper" value="#{cc.attrs.projectDescription}" />
			</p:menuitem>



public void onResetCopyBaselineInfo(ActionEvent event)
	{
		ProjectDescriptionWrapper itemSel = (ProjectDescriptionWrapper) event.getComponent().getAttributes().get("projectWrapper");
		setSelectedProjectDescriptionWrapper(itemSel);
		setNewBaseLineName(null);
	}


At other places Iam also using something like this

<p:menuitem id="menuItem" value="#{msgs['projectManagementActionsMenu.generalInfo']}" update=":generalInfoPanel" rendered="#{not (cc.attrs.elementName == 'Library')}" oncomplete="generalInfo.show()" icon="ui-icon-info">
			<f:setpropertyactionlistener target="#{projectManagementBean.selectedProjectDescriptionWrapper}" value="#{cc.attrs.projectDescription}" />
		</p:menuitem>


As I stated in my previous post , this only happens intermittently. If I refresh the whole page a couple times ..the listeners are getting invoked correctly.. this makes me suspect if it is a race condition issue..

Really appreciate your quick response and looking forward for your advise on this issue.

- Rajesh.
thumbnail
9年前 に Juan Gonzalez によって更新されました。

RE: Prime faces action listeners not getting invoked

Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿
In your first test portlet, can you try moving that commandLink out of <p:datatable> please?

And can you check if adding

<requires-namespaced-parameters>false</requires-namespaced-parameters>


to your liferay-portlet.xml makes that work?
9年前 に Rajesha Indurthi によって更新されました。

RE: Prime faces action listeners not getting invoked

New Member 投稿: 7 参加年月日: 13/10/01 最新の投稿
Juan,

Addig the test command link outside of the data table did not work as well and I also observed that the property which you wanted me to set to false is already set to false on my liferay-portlet.xml as shown below

<portlet>
		<portlet-name>1</portlet-name>
		<instanceable>true</instanceable>
		<remoteable>true</remoteable>
		<!-- JAVASERVERFACES-3031 -->
		<requires-namespaced-parameters>false</requires-namespaced-parameters>
		<ajaxable>false</ajaxable>
		<footer-portlet-javascript>/resources/js/editor.js</footer-portlet-javascript>
		<footer-portlet-javascript>/resources/js/editor.min.js</footer-portlet-javascript>
		<footer-portlet-javascript>/resources/js/jquery-ui-1.9.2.js</footer-portlet-javascript>
		<footer-portlet-javascript>/resources/js/jquery-ui-1.9.2.min.js</footer-portlet-javascript>
	</portlet>


Thanks
thumbnail
9年前 に Juan Gonzalez によって更新されました。

RE: Prime faces action listeners not getting invoked

Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿
When moving the commandLink outside the datatable, did you change the method signature as I said in a previous answer? Can you post the snippet after you latest change? (both xhtml and managed bean).

Does any actionListener work in your project?
9年前 に Rajesha Indurthi によって更新されました。

RE: Prime faces action listeners not getting invoked

New Member 投稿: 7 参加年月日: 13/10/01 最新の投稿
By putting the command link outside of the data table did not help me and I also observed that the 'requires-namespaced-parameters' is already set to false in my liferay-portlet.xml

<portlet>
		<portlet-name>1</portlet-name>
		<instanceable>true</instanceable>
		<remoteable>true</remoteable>
		<!-- JAVASERVERFACES-3031 -->
		<requires-namespaced-parameters>false</requires-namespaced-parameters>
		<ajaxable>false</ajaxable>
		<footer-portlet-javascript>/resources/js/editor.js</footer-portlet-javascript>
		<footer-portlet-javascript>/resources/js/editor.min.js</footer-portlet-javascript>
		<footer-portlet-javascript>/resources/js/jquery-ui-1.9.2.js</footer-portlet-javascript>
		<footer-portlet-javascript>/resources/js/jquery-ui-1.9.2.min.js</footer-portlet-javascript>
	</portlet>