掲示板

"ReferenceError: PrimeFaces is not defined" with render-weight=0

9年前 に Maximilian Franke によって更新されました。

"ReferenceError: PrimeFaces is not defined" with render-weight=0

New Member 投稿: 2 参加年月日: 14/12/02 最新の投稿
Hallo,
I get a js-Error ("ReferenceError: PrimeFaces is not defined" ), if i render my PrimefacesPortlet asynchronous.
My environment:
Liferay 6.1.2-ce-ga2 on Jboss 7.2

The problem, is easy to reproduce:
- New LiferayPluginProject of Type Portlet and with Primfeaces sample
- Edit the view.xhtml; change body-tag to:
...<h:body>
		<h:outputtext value="#{i18n['Test-hello-world']}" />
		<h:form>
			<p:remotecommand name="my_command" actionListener="#{testBean.echo('test')}" />
			<p:commandbutton type="button" onclick="my_command()" value="Test my_command" icon="ui-icon-refresh" />
		</h:form>
	</h:body>...

-Create bean:
...
@ManagedBean(name = "testBean")
@ViewScoped
public class TestBean {
	public void echo(String msg){
		System.out.println(msg);
	}
}


At this point you can deploy the Portlet and it works fine, but if you change the liferay-portlet.xml to
...
	<render-weight>0</render-weight>
	<ajaxable>true</ajaxable>
...

the error occurred.

Could you please provide help me? Many thanks!
thumbnail
9年前 に Vernon Singleton によって更新されました。

RE: "ReferenceError: PrimeFaces is not defined" with render-weight=0

Expert 投稿: 315 参加年月日: 13/01/14 最新の投稿
Hi Maximilian,

Maximilian Franke:
At this point you can deploy the Portlet and it works fine, but if you change the liferay-portlet.xml to
...
	<render-weight>0</render-weight>
	<ajaxable>true</ajaxable>
...

the error occurred.

Could you please provide help me? Many thanks!

You will notice that all of the jsf portlet demos have <ajaxable>false</ajaxable> in their liferay-portlet.xml ... and the ajax calls work just fine in all of them :-D

If you set ajaxable back to false, your portlet should start working again, including all of its ajax calls. That "ajaxable" xml tag probably has something to do with older non-JSF portlets. You can just leave it as false for your JSF portlets.
Let us know what you find.

Hope that helps,
Vernon
9年前 に Maximilian Franke によって更新されました。

RE: "ReferenceError: PrimeFaces is not defined" with render-weight=0

New Member 投稿: 2 参加年月日: 14/12/02 最新の投稿
Yes its works,
but i think the portlets not rendered asynchronous.

My Sample:
-View.xml
...
<h:body>
	<h:outputtext value="#{testBean.slowText}" />
</h:body>


-Bean
@ManagedBean(name = "testBean")
@ViewScoped
public class TestBean implements Serializable{...
	public String getSlowText(){
		try {
			Thread.sleep(10000); 
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		return "Lorem ipsum";
	}
}


liferay-portlet.xml:
		<instanceable>true</instanceable>
		<requires-namespaced-parameters>false</requires-namespaced-parameters>
		<render-weight>0</render-weight>
		<ajaxable>false</ajaxable>


With three Porlet-Instances on the Page, the page is displayed after ~30 seconds. This ist no differenz to render-wight=1, why the Page don't neeed ~10 seconds?
With ajaxable=true the Page is displayed very fast, with three rotating ajaxloaders, and the Page completely finsiched after ~10 seconds.
thumbnail
9年前 に Neil Griffin によって更新されました。

RE: "ReferenceError: PrimeFaces is not defined" with render-weight=0

Liferay Legend 投稿: 2655 参加年月日: 05/07/27 最新の投稿
Hi Maximilian,

According to the documentation for render-weight in liferay-portlet-app_6_2_0.dtd:

The default value of render-weight is 1. If set to a value less than 1, the
portlet is rendered in parallel. If set to a value of 1 or greater, then the
portlet is rendered serially. Portlets with a greater render weight have greater
priority and will be rendered before portlets with a lower render weight.

If the ajaxable value is set to false, then render-weight is always set to 1
if it is set to a value less than 1. This means ajaxable can override
render-weight if ajaxable is set to false.


Also, here is a quote from the description found in FACES-1773:

The new parallel rendering engine in Liferay 6.2 is incompatible with a feature in
Liferay Faces Bridge that provides the ability to remove duplicate resources in the
<head>...</head> section of the portal page.[

There are three known workarounds:
1) Disable parallel rendering in portal-ext.properties:
layout.parallel.render.enable=false
2) Add the p_p_parallel=0 query parameter to the URL in order to disable parallel rendering
on a per-request basis
3) Set the value of <render-weight> in each JSF portlet's WEB-INF/liferay-portlet.xml descriptor
to a value > 1. That should cause the portlets to render serially, rather than in parallel.


Kind Regards,

Neil