Forums de discussion
Embedding a custom instancable portlet in jsp
Lior Hadaya, modifié il y a 11 années.
Embedding a custom instancable portlet in jsp
Regular Member Publications: 138 Date d'inscription: 24/01/12 Publications récentes
Hi,
I'm using Liferay EE 6.1.20 and I am creating a hook which overrides \html\portal\layout\view\portlet.jsp.
In my override I want to add a static portlet to the jsp, which is a custom portlet I developed and it is instanceable.
I tried to use the liferay-portlet:runtime tag using just the name of the portlet but it did not work:
<liferay-portlet:runtime portletName="MyPortletName" />
It showed a message saying that the portlet has been undeployed.
If I understand correctly, since the portlet is instanceable I needed to specify the instance ID as part of the portlet name when I use the liferay-portlet:runtime tag - but I don't know how to generate a new instance id.
I tried to add the portlet manually to a page and then copy it's id from the look & feel / advanced styling tab, and it worked like this:
<liferay-portlet:runtime portletName="MyPortletName_WAR_ccihasiportalnavigationwebui04_INSTANCE_I2Ywg8MtPXQ1" />
This generated the portlet statically on the page but I couldn't add another instance of the same portlet to the page.
What's even more strange to me is when I placed "73" as the portletName which is the name of Liferay's OOTB instanceable Breadcrumbs portlet, it did work.
Do I really need to generate the instance id somehow if I want to use the runtime tag with my own custom portlet? if so how can I do it?
Thanks,
Lior
I'm using Liferay EE 6.1.20 and I am creating a hook which overrides \html\portal\layout\view\portlet.jsp.
In my override I want to add a static portlet to the jsp, which is a custom portlet I developed and it is instanceable.
I tried to use the liferay-portlet:runtime tag using just the name of the portlet but it did not work:
<liferay-portlet:runtime portletName="MyPortletName" />
It showed a message saying that the portlet has been undeployed.
If I understand correctly, since the portlet is instanceable I needed to specify the instance ID as part of the portlet name when I use the liferay-portlet:runtime tag - but I don't know how to generate a new instance id.
I tried to add the portlet manually to a page and then copy it's id from the look & feel / advanced styling tab, and it worked like this:
<liferay-portlet:runtime portletName="MyPortletName_WAR_ccihasiportalnavigationwebui04_INSTANCE_I2Ywg8MtPXQ1" />
This generated the portlet statically on the page but I couldn't add another instance of the same portlet to the page.
What's even more strange to me is when I placed "73" as the portletName which is the name of Liferay's OOTB instanceable Breadcrumbs portlet, it did work.
Do I really need to generate the instance id somehow if I want to use the runtime tag with my own custom portlet? if so how can I do it?
Thanks,
Lior
David H Nebinger, modifié il y a 11 années.
RE: Embedding a custom instancable portlet in jsp
Liferay Legend Publications: 14915 Date d'inscription: 02/09/06 Publications récentes
Well, it could be a matter of availability for the hook...
The breadcrumb portlet is part of the Liferay core and therefore is in the Liferay context. Your portlet, instantiable or not, is outside of that context and may not be available at load time.
Just a guess...
The breadcrumb portlet is part of the Liferay core and therefore is in the Liferay context. Your portlet, instantiable or not, is outside of that context and may not be available at load time.
Just a guess...
Satheesh Ravi, modifié il y a 11 années.
RE: Embedding a custom instancable portlet in jsp
Junior Member Publications: 35 Date d'inscription: 25/11/11 Publications récentes
Hi,
Everything is possible in liferay. But what you are doing isn't advisable! If any two portlets are tightly coupled it may create problem during run time. My advice is find an alternative method for doing the same.
Regards,
Satheesh
Everything is possible in liferay. But what you are doing isn't advisable! If any two portlets are tightly coupled it may create problem during run time. My advice is find an alternative method for doing the same.
Regards,
Satheesh
Lior Hadaya, modifié il y a 11 années.
RE: Embedding a custom instancable portlet in jsp
Regular Member Publications: 138 Date d'inscription: 24/01/12 Publications récentes
Hi Satheesh, thanks for replying.
I agree that copying the instance id from another portlet into the runtime tag is not advisable and not practical either. Can you suggest an alternative way of doing it?
I agree that copying the instance id from another portlet into the runtime tag is not advisable and not practical either. Can you suggest an alternative way of doing it?
Lior Hadaya, modifié il y a 11 années.
RE: Embedding a custom instancable portlet in jsp
Regular Member Publications: 138 Date d'inscription: 24/01/12 Publications récentes
Hi David, thanks for replying.
What do you mean by the portlet not being available at load time? Is there anything I can do to make it available?
I changed my portlet to non-instanceable and used this tag which worked:
<liferay-portlet:runtime portletName="myPortletName_WAR_myportletnamewebui" />
Why is problematic when the portlet is instanceable? is it simply not possible to use the runtime tag for an instanceable custom portlet? if so is there an alternative?
What do you mean by the portlet not being available at load time? Is there anything I can do to make it available?
I changed my portlet to non-instanceable and used this tag which worked:
<liferay-portlet:runtime portletName="myPortletName_WAR_myportletnamewebui" />
Why is problematic when the portlet is instanceable? is it simply not possible to use the runtime tag for an instanceable custom portlet? if so is there an alternative?
Hebatu Allah Fahmy, modifié il y a 11 années.
RE: Embedding a custom instancable portlet in jsp
Junior Member Publications: 41 Date d'inscription: 06/08/12 Publications récentes
Have you solved it , because I face the same problem !!
Lior Hadaya, modifié il y a 11 années.
RE: Embedding a custom instancable portlet in jsp
Regular Member Publications: 138 Date d'inscription: 24/01/12 Publications récentes
No, I haven't. I'm only embedding non-instanceable portlets for the time being.
Paul ., modifié il y a 11 années.
RE: Embedding a custom instancable portlet in jsp
Liferay Master Publications: 522 Date d'inscription: 29/08/11 Publications récentes
In you liferay-portlet.xml for you instanceable portlet add the following line and check if it works:-
<add-default-resource>true</add-default-resource>
Lior Hadaya, modifié il y a 11 années.
RE: Embedding a custom instancable portlet in jsp
Regular Member Publications: 138 Date d'inscription: 24/01/12 Publications récentes
Hi Paul,
After adding this line what am I supposed to do with the runtime statement?
<liferay-portlet:runtime portletName="MyPortletName_WAR_myportletnamewebui04_INSTANCE_I2Ywg8MtPXQ1" />
Thanks
After adding this line what am I supposed to do with the runtime statement?
<liferay-portlet:runtime portletName="MyPortletName_WAR_myportletnamewebui04_INSTANCE_I2Ywg8MtPXQ1" />
Thanks
Paul ., modifié il y a 11 années.
RE: Embedding a custom instancable portlet in jsp
Liferay Master Publications: 522 Date d'inscription: 29/08/11 Publications récentes
You just add the portlet without instance id in it. So
I am anxious to know the results.
<liferay-portlet:runtime portletName="MyPortletName_WAR_myportletnamewebui04_INSTANCE_I2Ywg8MtPXQ1" />
will change to something like <liferay-portlet:runtime portletName="MyPortletName_WAR_myportletnamewebui04" />
I am anxious to know the results.
Hebatu Allah Fahmy, modifié il y a 11 années.
RE: Embedding a custom instancable portlet in jsp
Junior Member Publications: 41 Date d'inscription: 06/08/12 Publications récentes
I have tried this in including asset publisher
instead of
<liferay-portlet:runtime portletName="#portlet_101_INSTANCE_XaF30gFyQsyD" />
I have used
<liferay-portlet:runtime portletName="portlet_101" />
and I have set <add-default-resource>true</add-default-resource> inside liferay-portlet.xml
as following
<portlet>
<portlet-name>TestPortlet</portlet-name>
<icon>/icon.png</icon>
<instanceable>false</instanceable>
<header-portlet-css>/css/main.css</header-portlet-css>
<footer-portlet-javascript>/js/main.js</footer-portlet-javascript>
<css-class-wrapper>TestPortlet-portlet</css-class-wrapper>
<add-default-resource>true</add-default-resource>
</portlet>
but the following exception appears to me in the server :-
NoSuchResourceException portlet101#ADD_TO_PAGE
here is all my liferay-portlet.xml
<?xml version="1.0"?>
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 6.1.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_6_1_0.dtd">
<liferay-portlet-app>
<portlet>
<portlet-name>TestPortlet</portlet-name>
<icon>/icon.png</icon>
<instanceable>false</instanceable>
<header-portlet-css>/css/main.css</header-portlet-css>
<footer-portlet-javascript>/js/main.js</footer-portlet-javascript>
<css-class-wrapper>TestPortlet-portlet</css-class-wrapper>
<add-default-resource>true</add-default-resource>
</portlet>
<role-mapper>
<role-name>administrator</role-name>
<role-link>Administrator</role-link>
</role-mapper>
<role-mapper>
<role-name>guest</role-name>
<role-link>Guest</role-link>
</role-mapper>
<role-mapper>
<role-name>power-user</role-name>
<role-link>Power User</role-link>
</role-mapper>
<role-mapper>
<role-name>user</role-name>
<role-link>User</role-link>
</role-mapper>
</liferay-portlet-app>
and i am using mvc portlet with jsp view
what is the problem ?
any help will be appreciated
Thanks in advance .
instead of
<liferay-portlet:runtime portletName="#portlet_101_INSTANCE_XaF30gFyQsyD" />
I have used
<liferay-portlet:runtime portletName="portlet_101" />
and I have set <add-default-resource>true</add-default-resource> inside liferay-portlet.xml
as following
<portlet>
<portlet-name>TestPortlet</portlet-name>
<icon>/icon.png</icon>
<instanceable>false</instanceable>
<header-portlet-css>/css/main.css</header-portlet-css>
<footer-portlet-javascript>/js/main.js</footer-portlet-javascript>
<css-class-wrapper>TestPortlet-portlet</css-class-wrapper>
<add-default-resource>true</add-default-resource>
</portlet>
but the following exception appears to me in the server :-
NoSuchResourceException portlet101#ADD_TO_PAGE
here is all my liferay-portlet.xml
<?xml version="1.0"?>
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 6.1.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_6_1_0.dtd">
<liferay-portlet-app>
<portlet>
<portlet-name>TestPortlet</portlet-name>
<icon>/icon.png</icon>
<instanceable>false</instanceable>
<header-portlet-css>/css/main.css</header-portlet-css>
<footer-portlet-javascript>/js/main.js</footer-portlet-javascript>
<css-class-wrapper>TestPortlet-portlet</css-class-wrapper>
<add-default-resource>true</add-default-resource>
</portlet>
<role-mapper>
<role-name>administrator</role-name>
<role-link>Administrator</role-link>
</role-mapper>
<role-mapper>
<role-name>guest</role-name>
<role-link>Guest</role-link>
</role-mapper>
<role-mapper>
<role-name>power-user</role-name>
<role-link>Power User</role-link>
</role-mapper>
<role-mapper>
<role-name>user</role-name>
<role-link>User</role-link>
</role-mapper>
</liferay-portlet-app>
and i am using mvc portlet with jsp view
what is the problem ?
any help will be appreciated
Thanks in advance .
Paul ., modifié il y a 11 années.
RE: Embedding a custom instancable portlet in jsp
Liferay Master Publications: 522 Date d'inscription: 29/08/11 Publications récentes
The solution I suggested was for adding a custom portlet and so was the problem described by the original poster. The situation you have is slightly different and has been discussed in many other threads like this one http://www.liferay.com/community/forums/-/message_boards/message/10936029 , please search for a similar thread.
Lior Hadaya, modifié il y a 11 années.
RE: Embedding a custom instancable portlet in jsp
Regular Member Publications: 138 Date d'inscription: 24/01/12 Publications récentesBart Simpson:
You just add the portlet without instance id in it. Sowill change to something like<liferay-portlet:runtime portletName="MyPortletName_WAR_myportletnamewebui04_INSTANCE_I2Ywg8MtPXQ1" />
<liferay-portlet:runtime portletName="MyPortletName_WAR_myportletnamewebui04" />
I am anxious to know the results.
Your solution worked!
Is there any downside to setting add-default-resource to true?
I tried to look it up but didn't really understand the meaning..
"add-default-resource
If the add-default-resource value is set to false, and the portlet does not belong to the page but has been dynamically added, then the user will see that he does not have permissions to view the portlet. If the add-default-resource value is set to true, the default portlet resources and permissions are added to the page. The user can then view the portlet. Most portlets are harmless and can benefit from this flexibility. However, to prevent security loop holes, the default value is false."
http://docs.liferay.com/portal/4.2/official/liferay-portlet-development-guide-4.2/multipage/ch02.html
Thanks
Bart Simpson, modifié il y a 11 années.
RE: Embedding a custom instancable portlet in jsp
Liferay Master Publications: 522 Date d'inscription: 29/08/11 Publications récentess there any downside to setting add-default-resource to true?
I tried to look it up but didn't really understand the meaning..
Yeah that is some magic I need to debug and check..in time I will
subhash lamba, modifié il y a 10 années.
RE: Embedding a custom instancable portlet in jsp
Regular Member Publications: 136 Date d'inscription: 07/07/13 Publications récentes
i followed same procedure but i got error like
please help to solve this problem.
javax.servlet.jsp.JspException: ServletException in '/html/common/themes/portlet.jsp': File "/html/common/themes/portlet.jsp" not found
at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:923)
at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:462)
at org.apache.jsp.html.portal.render_005fportlet_jsp._jspService(render_005fportlet_jsp.java:1559)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at com.liferay.portal.servlet.DirectRequestDispatcher.include(DirectRequestDispatcher.java:97)
at com.liferay.portal.servlet.PACLRequestDispatcherWrapper.doDispatch(PACLRequestDispatcherWrapper.java:90)
at com.liferay.portal.servlet.PACLRequestDispatcherWrapper.include(PACLRequestDispatcherWrapper.java:54)
at com.liferay.portal.util.PortalImpl.renderPortlet(PortalImpl.java:5158)
at com.liferay.portal.util.PortalUtil.renderPortlet(PortalUtil.java:1569)
at com.liferay.portlet.layoutconfiguration.util.RuntimePortletImpl.processPortlet(RuntimePortletImpl.java:165)
at com.liferay.portlet.layoutconfiguration.util.RuntimePortletImpl.processPortlet(RuntimePortletImpl.java:203)
at com.liferay.portlet.layoutconfiguration.util.RuntimePortletImpl.processPortlet(RuntimePortletImpl.java:190)
at com.liferay.portlet.layoutconfiguration.util.RuntimePortletUtil.processPortlet(RuntimePortletUtil.java:87)
at com.liferay.taglib.portletext.RuntimeTag.doTag(RuntimeTag.java:111)
at com.liferay.taglib.portletext.RuntimeTag.doEndTag(RuntimeTag.java:150)
at org.apache.jsp.WEB_002dINF.html.jsp.view_jsp._jspx_meth_liferay_002dportlet_005fruntime_005f0(view_jsp.java:442)
at org.apache.jsp.WEB_002dINF.html.jsp.view_jsp._jspService(view_jsp.java:324)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:73)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:593)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:530)
at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:229)
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:262)
at org.springframework.web.servlet.ViewRendererServlet.renderView(ViewRendererServlet.java:114)
at org.springframework.web.servlet.ViewRendererServlet.processRequest(ViewRendererServlet.java:86)
at org.springframework.web.servlet.ViewRendererServlet.doGet(ViewRendererServlet.java:66)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:73)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:593)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:530)
at com.liferay.portlet.PortletRequestDispatcherImpl.dispatch(PortletRequestDispatcherImpl.java:323)
at com.liferay.portlet.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:105)
at org.springframework.web.portlet.DispatcherPortlet.doDispatch(DispatcherPortlet.java:1194)
at org.springframework.web.portlet.DispatcherPortlet.doRender(DispatcherPortlet.java:1175)
at org.springframework.web.portlet.DispatcherPortlet.render(DispatcherPortlet.java:1130)
at org.springframework.web.portlet.DispatcherPortlet.doRenderService(DispatcherPortlet.java:789)
at org.springframework.web.portlet.FrameworkPortlet.processRequest(FrameworkPortlet.java:522)
at org.springframework.web.portlet.FrameworkPortlet.doDispatch(FrameworkPortlet.java:470)
at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64)
at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:111)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:73)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:593)
at
please help to solve this problem.
Juan Gonzalez, modifié il y a 10 années.
RE: Embedding a custom instancable portlet in jsp
Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentes
It's solved in current master branch and will be available in next version:
http://issues.liferay.com/browse/LPS-31508
http://issues.liferay.com/browse/LPS-31508
subhash lamba, modifié il y a 10 années.
RE: Embedding a custom instancable portlet in jsp
Regular Member Publications: 136 Date d'inscription: 07/07/13 Publications récentes
Hi .. Juan Gonzalez
Error gone because i set <add-default-resource>false</add-default-resource> in my portlet but sub-portlet is not visible.
there is not error but inner portlet also not visible.
Error gone because i set <add-default-resource>false</add-default-resource> in my portlet but sub-portlet is not visible.
there is not error but inner portlet also not visible.
Juan Gonzalez, modifié il y a 10 années.
RE: Embedding a custom instancable portlet in jsp
Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentes
Yep, it's already solved, so you'd have to wait a bit...
subhash lamba, modifié il y a 10 années.
RE: Embedding a custom instancable portlet in jsp
Regular Member Publications: 136 Date d'inscription: 07/07/13 Publications récentes
for now... what?
what should i do??
I am running out of time
what should i do??
I am running out of time
Juan Gonzalez, modifié il y a 10 années.
RE: Embedding a custom instancable portlet in jsp
Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentes
You can purchase for a EE license (so you can get patches), or patch by yourself. You can get the changes in github by searching for "LPS-31508".
subhash lamba, modifié il y a 10 années.
RE: Embedding a custom instancable portlet in jsp
Regular Member Publications: 136 Date d'inscription: 07/07/13 Publications récentes
LPS-31508 according to this i chages in two tld filed but there are not any changes same problem are there..
Juan Gonzalez, modifié il y a 10 années.
RE: Embedding a custom instancable portlet in jsp
Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentes
Sorry don't understand...
subhash lamba, modifié il y a 10 années.
RE: Embedding a custom instancable portlet in jsp
Regular Member Publications: 136 Date d'inscription: 07/07/13 Publications récentes
https://github.com/liferay/liferay-portal/tree/master/portal-web/docroot/WEB-INF/tld
there are two tld file copy it and paste in update in my tld folder but there are same effect.
Nd how to patch in liferay to update it. can u tell me plz?
there are two tld file copy it and paste in update in my tld folder but there are same effect.
Nd how to patch in liferay to update it. can u tell me plz?
subhash lamba, modifié il y a 10 années.
RE: Embedding a custom instancable portlet in jsp
Regular Member Publications: 136 Date d'inscription: 07/07/13 Publications récentes
https://github.com/liferay/liferay-portal/tree/master/portal-web/docroot/WEB-INF/tld
there are two tld file copy it and paste in update in my tld folder but there are same effect.
Nd how to patch in liferay to update it. can u tell me plz?
there are two tld file copy it and paste in update in my tld folder but there are same effect.
Nd how to patch in liferay to update it. can u tell me plz?
Juan Gonzalez, modifié il y a 10 années.
RE: Embedding a custom instancable portlet in jsp
Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentes
There are some threads and wiki about how to patch, sorry.
There are also some tools for finding git commits, so you know what you have to patch.
There are also some tools for finding git commits, so you know what you have to patch.