Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Embeded portlet constructor or pageLoad is not called in web content
Hi folks,
I've created the jsf portlet and embeded it into web content. But issue is consctructor of portlet is not called while i embed this portlet in theme then constructor get called.
This same issue occurs for the Jsp porltel mvc
Additionally ,as ususally when i drag and drop the portlet on page and refresh it works smoothly and constructor method get called.
I've put my controller class bean scope is request in facing-config.xml for jsf.
I've been following this link and using this tag <@liferay_portlet["runtime"] for embeding portlet.
Any body have idea about this how to resolve this issue in LR 7.1
Please help.
Thanks in advance.
Bilal
I've created the jsf portlet and embeded it into web content. But issue is consctructor of portlet is not called while i embed this portlet in theme then constructor get called.
This same issue occurs for the Jsp porltel mvc
Additionally ,as ususally when i drag and drop the portlet on page and refresh it works smoothly and constructor method get called.
I've put my controller class bean scope is request in facing-config.xml for jsf.
I've been following this link and using this tag <@liferay_portlet["runtime"] for embeding portlet.
Any body have idea about this how to resolve this issue in LR 7.1
Please help.
Thanks in advance.
Bilal
Bilal HussainJust like with Servlets, there's typically only one Portlet Object only in the whole system. The portlet is not supposed to have any internal state: The state is passed through the Request and Response object. What you describe is working as it's designed.
I've created the jsf portlet and embeded it into web content. But issue is consctructor of portlet is not called while i embed this portlet in theme then constructor get called.
This same issue occurs for the Jsp porltel mvc
Think of it: Would you expect one object per page? Or one object per page and user? Or just one object per user, whatever page it might be on? Would you expect all portlets of a site to be instantiated or just the current page? Would you expect them to stay around in memory until the session runs out, or just until the request is handled successfully?
While you might have an answer for your expectation, everybody would have a different answer. And commonly, there's only one object ever, because they're not supposed to keep any state anyways. AFAIK the spec doesn't specify it at all, but more objects don't make any sense for any implementation.
Section 5.2 of the Portlet 3.0 Specification titled "Relationship to the Portlet Context" states:
Other sections in the spec reinforce the singleton nature of a portlet as well. For example, Section 4.8.1 titled "Initialization and Destruction" states:
The portlet container must enforce a one-to-one correspondence between a portlet application and its portlet context. If the application is a distributed application, the portlet container must create a single PortletContext instance per VM. A PortletContext object provides a portlet with information about the application.
Other sections in the spec reinforce the singleton nature of a portlet as well. For example, Section 4.8.1 titled "Initialization and Destruction" states:
The portlet container calls the annotated method to initialize the portlet when it is being placed into service.
Thanks Olaf and Neil for you reply.
Issue has been resolved. Actually while creating template of web content I've checked the "chacheable" checkbox. This is not allowing to update or modify the embeded portlet in web content.
Just I've unchecked the "chacheable" checkbox in template and issue get resolved.
Issue has been resolved. Actually while creating template of web content I've checked the "chacheable" checkbox. This is not allowing to update or modify the embeded portlet in web content.
Just I've unchecked the "chacheable" checkbox in template and issue get resolved.
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™