留言板

Primefaces Dialog does not work with multiple portlets

Ingo Schildmann,修改在11 年前。

Primefaces Dialog does not work with multiple portlets

New Member 帖子: 14 加入日期: 11-12-21 最近的帖子
Hi,

we use Liferay 6.1.1-ce-ga2 with JBoss 7.1.1 and implement portlets with PrimeFaces 3.4.2 and liferay-faces-portal 3.1.0-ga1

Because we configure the ui at runtime, we use component binding.
With a single portlet we had no problems with showing and hiding PrimeFaces' Dialogs.
But when I have another portlet at a page, the Dialog doesn't work anymore.

I made an example project (build with mvn -Pjboss please).
The portlet "Test data" should show a Dialog when the button "Start" is clicked.
The portlet "Test Menu" just reloads the portlet "TestData" via IPC when "Start" in the "StartMenu" is clicked.

The dialog of "Test data" only works if the portlet "Test Menu is not present.

I'm not sure whether this behavour depends on javax.faces.PARTIAL_STATE_SAVING or whether liferay-portlet.xml is incorrect.

Regards, Ingo
thumbnail
Neil Griffin,修改在11 年前。

RE: Primefaces Dialog does not work with multiple portlets

Liferay Legend 帖子: 2655 加入日期: 05-7-27 最近的帖子
I didn't have JBoss setup, so I tried your portlet with Liferay 6.1.1-ce-ga2 and Tomcat. I had to un-comment the Mojarra exclusions and change the version of liferay-faces-portal to 3.1.1-ga2-SNAPSHOT in the pom.xml tomcat profile in order to get it to build right. It worked OK for me without any problems. Are you saying that this is only a problem when deployed with JBoss AS?
Ingo Schildmann,修改在11 年前。

RE: Primefaces Dialog does not work with multiple portlets

New Member 帖子: 14 加入日期: 11-12-21 最近的帖子
Hi Neil, thank you for trying my portlet.
I just installed a new Liferay 6.1 CE GA2 bundled with Tomcat and still have the problem that the popup in "Test data" isn't shown when "Test Menu" is on the same page.

I think I did the same changes to the pom like you did.

My pom.xml (jboss profile removed for brevity):
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelversion>4.0.0</modelversion>
	<groupid>de.karb</groupid>
	<artifactid>popuptest-portlet</artifactid>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>war</packaging>

	<dependencies>

		<dependency>
			<groupid>javax.portlet</groupid>
			<artifactid>portlet-api</artifactid>
			<version>2.0</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupid>javax.servlet</groupid>
			<artifactid>javax.servlet-api</artifactid>
			<version>3.0.1</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupid>org.primefaces</groupid>
			<artifactid>primefaces</artifactid>
			<version>3.4.2</version>
		</dependency>

		<dependency>
			<groupid>javax.el</groupid>
			<artifactid>el-api</artifactid>
			<version>1.0</version>
			<scope>provided</scope>
		</dependency>
		
		<dependency>
			<groupid>log4j</groupid>
			<artifactid>log4j</artifactid>
			<version>1.2.14</version>
			<type>jar</type>
			<scope>compile</scope>
		</dependency>

	</dependencies>

	<profiles>
		<profile>
			<id>tomcat</id>
			<activation>
				<activebydefault>true</activebydefault>
			</activation>
			<dependencies>

				<dependency>
					<groupid>com.liferay.portal</groupid>
					<artifactid>portal-service</artifactid>
					<version>6.1.1</version>
					<scope>provided</scope>
				</dependency>

				<dependency>
					<groupid>com.liferay.faces</groupid>
					<artifactid>liferay-faces-portal</artifactid>
					<version>3.1.1-ga2-SNAPSHOT</version>					
				</dependency>
				
			</dependencies>
		</profile>
		
	</profiles>

	<build>
		<plugins>
			<plugin>
				<groupid>org.apache.maven.plugins</groupid>
				<artifactid>maven-compiler-plugin</artifactid>
				<version>2.3.2</version>
				<configuration>
					<source>1.6
					<target>1.6</target>
					<encoding>UTF-8</encoding>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>
thumbnail
Neil Griffin,修改在11 年前。

RE: Primefaces Dialog does not work with multiple portlets

Liferay Legend 帖子: 2655 加入日期: 05-7-27 最近的帖子
Hi Ingo,

I've attached the pom.xml descriptor and the WAR that I built with Maven. Please give them a try on your Liferay+Tomcat bundle. It's working fine on my side -- I can't reproduce the issue.

Thanks,

Neil
Ingo Schildmann,修改在11 年前。

RE: Primefaces Dialog does not work with multiple portlets

New Member 帖子: 14 加入日期: 11-12-21 最近的帖子
Hi Neal,

At first your build worked fine but mine still didn't.
Then I noticed that it depends (at least at my tomcat liferay) how I add the portlets, for both builds.

As admin I drag the portlets to place them on the page, then I reload because of the messages "...will only be shown after you refresh the current page."
Now the Start button of "Test data" does not work.
But it does as soon as I move the "Test data" portlet again, and then it works also for non-admins and after restart.

I will now test whether this "workaround" also works for JBoss.

Thanks, Ingo
Ingo Schildmann,修改在11 年前。

RE: Primefaces Dialog does not work with multiple portlets

New Member 帖子: 14 加入日期: 11-12-21 最近的帖子
The dialog works also in JBoss after moving the portlet.

Unfortunately this trick doesn't help in our real application, where the creation of the component binding is more complex.

I tried a tiny more complex test portlet, where the button is first rendered, when start has been selected in the menu.
But this also works after the movement of the portlet.

So I have to make the test portlet more and more complex until the dialog doesn't work anymore like in our application.
Until the end of the week I'm out of office, so I will report again next week.

Thanks for the help so far,
Ingo
Ingo Schildmann,修改在11 年前。

RE: Primefaces Dialog does not work with multiple portlets

New Member 帖子: 14 加入日期: 11-12-21 最近的帖子
Hi,

the trick wasn't just to move the portlet that contains the dialog, but to move the portlet to the uppermost left position.
I could confirm this in our application.
Of course that's not a satisfying solution to have the menu at the right side.

Neil, could you please check whether at your Tomcat environment the dialog also only works if the "test data" portlet is at the upper left position?

Thanks, Ingo
thumbnail
Neil Griffin,修改在11 年前。

RE: Primefaces Dialog does not work with multiple portlets

Liferay Legend 帖子: 2655 加入日期: 05-7-27 最近的帖子
When both portlets are dragged to the same portal page column, then it works OK. I was able to reproduce the problem if the portlets appear in different portal page columns. The Chrome debugger revealed that the browser started to bombard the server with an infinite loop of Ajax requests.

In the case of two columns (column-1 and column-2), then the only difference that I can think of is that the URL invoked for Ajax requests would have a URL parameter p_p_col_id=column-1 versus p_p_col_id=column-2.

So my recommendation would be that you debug the XmlHttpRequest traffic to see what is causing the infinite loop.

On a side note, is it totally necessary for you to use the binding attribute and do much component creation dynamically via Java? JSF will let you do this of course, but if possible, I would recommend doing as much as you can declaratively in xhtml, using c:if and rendered in order to control the component tree.