Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Embedding a custom instancable portlet in jsp Lior Hadaya August 19, 2012 6:11 AM
RE: Embedding a custom instancable portlet in jsp David H Nebinger August 19, 2012 7:29 AM
RE: Embedding a custom instancable portlet in jsp Satheesh Ravi August 19, 2012 9:17 AM
RE: Embedding a custom instancable portlet in jsp Lior Hadaya August 19, 2012 11:00 PM
RE: Embedding a custom instancable portlet in jsp Lior Hadaya August 19, 2012 10:57 PM
RE: Embedding a custom instancable portlet in jsp Hebatu Allah Fahmy September 18, 2012 6:39 AM
RE: Embedding a custom instancable portlet in jsp Lior Hadaya September 18, 2012 9:26 PM
RE: Embedding a custom instancable portlet in jsp Bart Simpson September 19, 2012 12:02 AM
RE: Embedding a custom instancable portlet in jsp Lior Hadaya September 19, 2012 10:41 PM
RE: Embedding a custom instancable portlet in jsp Bart Simpson September 20, 2012 9:20 PM
RE: Embedding a custom instancable portlet in jsp Hebatu Allah Fahmy September 23, 2012 1:31 AM
RE: Embedding a custom instancable portlet in jsp Bart Simpson September 23, 2012 9:33 PM
RE: Embedding a custom instancable portlet in jsp Lior Hadaya October 11, 2012 12:52 AM
RE: Embedding a custom instancable portlet in jsp Bart Simpson October 11, 2012 1:46 AM
RE: Embedding a custom instancable portlet in jsp subhash lamba July 16, 2013 11:05 PM
RE: Embedding a custom instancable portlet in jsp Juan Gonzalez July 17, 2013 1:57 AM
RE: Embedding a custom instancable portlet in jsp subhash lamba July 17, 2013 2:12 AM
RE: Embedding a custom instancable portlet in jsp Juan Gonzalez July 17, 2013 2:12 AM
RE: Embedding a custom instancable portlet in jsp subhash lamba July 17, 2013 2:19 AM
RE: Embedding a custom instancable portlet in jsp Juan Gonzalez July 17, 2013 2:22 AM
RE: Embedding a custom instancable portlet in jsp subhash lamba July 17, 2013 3:03 AM
RE: Embedding a custom instancable portlet in jsp Juan Gonzalez July 17, 2013 3:06 AM
RE: Embedding a custom instancable portlet in jsp subhash lamba July 17, 2013 3:11 AM
RE: Embedding a custom instancable portlet in jsp subhash lamba July 17, 2013 3:11 AM
RE: Embedding a custom instancable portlet in jsp Juan Gonzalez July 17, 2013 3:14 AM
Lior Hadaya
Embedding a custom instancable portlet in jsp
August 19, 2012 6:11 AM
Answer

Lior Hadaya

Rank: Regular Member

Posts: 138

Join Date: January 24, 2012

Recent Posts

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
David H Nebinger
RE: Embedding a custom instancable portlet in jsp
August 19, 2012 7:29 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 11262

Join Date: September 1, 2006

Recent Posts

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...
Satheesh Ravi
RE: Embedding a custom instancable portlet in jsp
August 19, 2012 9:17 AM
Answer

Satheesh Ravi

Rank: Junior Member

Posts: 35

Join Date: November 24, 2011

Recent Posts

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
Lior Hadaya
RE: Embedding a custom instancable portlet in jsp
August 19, 2012 10:57 PM
Answer

Lior Hadaya

Rank: Regular Member

Posts: 138

Join Date: January 24, 2012

Recent Posts

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?
Lior Hadaya
RE: Embedding a custom instancable portlet in jsp
August 19, 2012 11:00 PM
Answer

Lior Hadaya

Rank: Regular Member

Posts: 138

Join Date: January 24, 2012

Recent Posts

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?
Hebatu Allah Fahmy
RE: Embedding a custom instancable portlet in jsp
September 18, 2012 6:39 AM
Answer

Hebatu Allah Fahmy

Rank: Junior Member

Posts: 41

Join Date: August 6, 2012

Recent Posts

Have you solved it , because I face the same problem !!
Lior Hadaya
RE: Embedding a custom instancable portlet in jsp
September 18, 2012 9:26 PM
Answer

Lior Hadaya

Rank: Regular Member

Posts: 138

Join Date: January 24, 2012

Recent Posts

No, I haven't. I'm only embedding non-instanceable portlets for the time being.
Bart Simpson
RE: Embedding a custom instancable portlet in jsp
September 19, 2012 12:02 AM
Answer

Bart Simpson

Rank: Liferay Master

Posts: 524

Join Date: August 29, 2011

Recent Posts

In you liferay-portlet.xml for you instanceable portlet add the following line and check if it works:-

1<add-default-resource>true</add-default-resource>
Lior Hadaya
RE: Embedding a custom instancable portlet in jsp
September 19, 2012 10:41 PM
Answer

Lior Hadaya

Rank: Regular Member

Posts: 138

Join Date: January 24, 2012

Recent Posts

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
Bart Simpson
RE: Embedding a custom instancable portlet in jsp
September 20, 2012 9:20 PM
Answer

Bart Simpson

Rank: Liferay Master

Posts: 524

Join Date: August 29, 2011

Recent Posts

You just add the portlet without instance id in it. So
1<liferay-portlet:runtime portletName="MyPortletName_WAR_myportletnamewebui04_INSTANCE_I2Ywg8MtPXQ1" />
will change to something like
1<liferay-portlet:runtime portletName="MyPortletName_WAR_myportletnamewebui04" />

I am anxious to know the results. emoticon
Hebatu Allah Fahmy
RE: Embedding a custom instancable portlet in jsp
September 23, 2012 1:31 AM
Answer

Hebatu Allah Fahmy

Rank: Junior Member

Posts: 41

Join Date: August 6, 2012

Recent Posts

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 .
Bart Simpson
RE: Embedding a custom instancable portlet in jsp
September 23, 2012 9:33 PM
Answer

Bart Simpson

Rank: Liferay Master

Posts: 524

Join Date: August 29, 2011

Recent Posts

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
RE: Embedding a custom instancable portlet in jsp
October 11, 2012 12:52 AM
Answer

Lior Hadaya

Rank: Regular Member

Posts: 138

Join Date: January 24, 2012

Recent Posts

Bart Simpson:
You just add the portlet without instance id in it. So
1<liferay-portlet:runtime portletName="MyPortletName_WAR_myportletnamewebui04_INSTANCE_I2Ywg8MtPXQ1" />
will change to something like
1<liferay-portlet:runtime portletName="MyPortletName_WAR_myportletnamewebui04" />

I am anxious to know the results. emoticon


Your solution worked! emoticon

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
RE: Embedding a custom instancable portlet in jsp
October 11, 2012 1:46 AM
Answer

Bart Simpson

Rank: Liferay Master

Posts: 524

Join Date: August 29, 2011

Recent Posts

s 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 emoticon I need to debug and check..in time I will emoticon
subhash lamba
RE: Embedding a custom instancable portlet in jsp
July 16, 2013 11:05 PM
Answer

subhash lamba

Rank: Regular Member

Posts: 136

Join Date: July 7, 2013

Recent Posts

i followed same procedure but i got error like

 1javax.servlet.jsp.JspException: ServletException in '/html/common/themes/portlet.jsp': File &quot;/html/common/themes/portlet.jsp&quot; not found
 2    at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:923)
 3    at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:462)
 4    at org.apache.jsp.html.portal.render_005fportlet_jsp._jspService(render_005fportlet_jsp.java:1559)
 5    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
 6    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
 7    at com.liferay.portal.servlet.DirectRequestDispatcher.include(DirectRequestDispatcher.java:97)
 8    at com.liferay.portal.servlet.PACLRequestDispatcherWrapper.doDispatch(PACLRequestDispatcherWrapper.java:90)
 9    at com.liferay.portal.servlet.PACLRequestDispatcherWrapper.include(PACLRequestDispatcherWrapper.java:54)
10    at com.liferay.portal.util.PortalImpl.renderPortlet(PortalImpl.java:5158)
11    at com.liferay.portal.util.PortalUtil.renderPortlet(PortalUtil.java:1569)
12    at com.liferay.portlet.layoutconfiguration.util.RuntimePortletImpl.processPortlet(RuntimePortletImpl.java:165)
13    at com.liferay.portlet.layoutconfiguration.util.RuntimePortletImpl.processPortlet(RuntimePortletImpl.java:203)
14    at com.liferay.portlet.layoutconfiguration.util.RuntimePortletImpl.processPortlet(RuntimePortletImpl.java:190)
15    at com.liferay.portlet.layoutconfiguration.util.RuntimePortletUtil.processPortlet(RuntimePortletUtil.java:87)
16    at com.liferay.taglib.portletext.RuntimeTag.doTag(RuntimeTag.java:111)
17    at com.liferay.taglib.portletext.RuntimeTag.doEndTag(RuntimeTag.java:150)
18    at org.apache.jsp.WEB_002dINF.html.jsp.view_jsp._jspx_meth_liferay_002dportlet_005fruntime_005f0(view_jsp.java:442)
19    at org.apache.jsp.WEB_002dINF.html.jsp.view_jsp._jspService(view_jsp.java:324)
20    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
21    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
22    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
23    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
24    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
25    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
26    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
27    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
28    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
29    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
30    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:73)
31    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
32    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
33    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
34    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:593)
35    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:530)
36    at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:229)
37    at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:262)
38    at org.springframework.web.servlet.ViewRendererServlet.renderView(ViewRendererServlet.java:114)
39    at org.springframework.web.servlet.ViewRendererServlet.processRequest(ViewRendererServlet.java:86)
40    at org.springframework.web.servlet.ViewRendererServlet.doGet(ViewRendererServlet.java:66)
41    at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
42    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
43    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
44    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
45    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
46    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:73)
47    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
48    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
49    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
50    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:593)
51    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:530)
52    at com.liferay.portlet.PortletRequestDispatcherImpl.dispatch(PortletRequestDispatcherImpl.java:323)
53    at com.liferay.portlet.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:105)
54    at org.springframework.web.portlet.DispatcherPortlet.doDispatch(DispatcherPortlet.java:1194)
55    at org.springframework.web.portlet.DispatcherPortlet.doRender(DispatcherPortlet.java:1175)
56    at org.springframework.web.portlet.DispatcherPortlet.render(DispatcherPortlet.java:1130)
57    at org.springframework.web.portlet.DispatcherPortlet.doRenderService(DispatcherPortlet.java:789)
58    at org.springframework.web.portlet.FrameworkPortlet.processRequest(FrameworkPortlet.java:522)
59    at org.springframework.web.portlet.FrameworkPortlet.doDispatch(FrameworkPortlet.java:470)
60    at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)
61    at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)
62    at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64)
63    at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:111)
64    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
65    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
66    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
67    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
68    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:73)
69    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
70    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
71    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
72    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:593)
73    at


please help to solve this problem.
Juan Gonzalez
RE: Embedding a custom instancable portlet in jsp
July 17, 2013 1:57 AM
Answer

Juan Gonzalez

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2848

Join Date: October 28, 2008

Recent Posts

It's solved in current master branch and will be available in next version:

http://issues.liferay.com/browse/LPS-31508
subhash lamba
RE: Embedding a custom instancable portlet in jsp
July 17, 2013 2:12 AM
Answer

subhash lamba

Rank: Regular Member

Posts: 136

Join Date: July 7, 2013

Recent Posts

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.emoticon
Juan Gonzalez
RE: Embedding a custom instancable portlet in jsp
July 17, 2013 2:12 AM
Answer

Juan Gonzalez

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2848

Join Date: October 28, 2008

Recent Posts

Yep, it's already solved, so you'd have to wait a bit...
subhash lamba
RE: Embedding a custom instancable portlet in jsp
July 17, 2013 2:19 AM
Answer

subhash lamba

Rank: Regular Member

Posts: 136

Join Date: July 7, 2013

Recent Posts

for now... what?
what should i do??
I am running out of time
Juan Gonzalez
RE: Embedding a custom instancable portlet in jsp
July 17, 2013 2:22 AM
Answer

Juan Gonzalez

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2848

Join Date: October 28, 2008

Recent Posts

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
RE: Embedding a custom instancable portlet in jsp
July 17, 2013 3:03 AM
Answer

subhash lamba

Rank: Regular Member

Posts: 136

Join Date: July 7, 2013

Recent Posts

LPS-31508 according to this i chages in two tld filed but there are not any changes same problem are there..
Juan Gonzalez
RE: Embedding a custom instancable portlet in jsp
July 17, 2013 3:06 AM
Answer

Juan Gonzalez

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2848

Join Date: October 28, 2008

Recent Posts

Sorry don't understand...
subhash lamba
RE: Embedding a custom instancable portlet in jsp
July 17, 2013 3:11 AM
Answer

subhash lamba

Rank: Regular Member

Posts: 136

Join Date: July 7, 2013

Recent Posts

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?
subhash lamba
RE: Embedding a custom instancable portlet in jsp
July 17, 2013 3:11 AM
Answer

subhash lamba

Rank: Regular Member

Posts: 136

Join Date: July 7, 2013

Recent Posts

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?
Juan Gonzalez
RE: Embedding a custom instancable portlet in jsp
July 17, 2013 3:14 AM
Answer

Juan Gonzalez

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2848

Join Date: October 28, 2008

Recent Posts

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.