Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Aneesha Rao
RenderURL in hooks
July 30, 2012 4:15 AM
Answer

Aneesha Rao

Rank: New Member

Posts: 14

Join Date: February 24, 2012

Recent Posts

Hi,

Renderurl in hooks navigates outside the portlet..

I have referred this link

view.jsp
1
2<portlet:renderURL var="AneeVar" portletMode="view">
3
4    <portlet:param name="struts_action" value="/liferayPortlet" />
5
6</portlet:renderURL>
7
8<p><a href="<%= AneeVar %>">RENDER URL LINK</a></p>



NavigateAction.java
 1
 2package com.infy.myhook.action;
 3
 4import javax.portlet.PortletConfig;
 5import javax.portlet.RenderRequest;
 6import javax.portlet.RenderResponse;
 7
 8import com.liferay.portal.kernel.struts.BaseStrutsPortletAction;
 9import com.liferay.portal.kernel.struts.StrutsPortletAction;
10
11public class NavigateAction extends BaseStrutsPortletAction {
12    @Override
13    public String render(
14            StrutsPortletAction originalStrutsPortletAction,
15            PortletConfig portletConfig, RenderRequest renderRequest,
16            RenderResponse renderResponse)
17        throws Exception {
18
19        return "/portlet/liferayPortlet/new.jsp";
20    }
21}


new.jsp has say.. hi all! its rendered

liferay-hook.xml
 1
 2<hook>
 3<custom-jsp-dir>/META-INF/custom_jsps</custom-jsp-dir>
 4
 5    <struts-action>
 6    <struts-action-path>/liferayPortlet</struts-action-path>
 7    <struts-action-impl>com.infy.myhook.action.NavigateAction</struts-action-impl>
 8</struts-action>
 9
10</hook>



How can I get the content of new.jsp inside the portlet?

--Thanks and Regards,
Aneesha
Amit Doshi
RE: RenderURL in hooks
July 30, 2012 4:42 AM
Answer

Amit Doshi

Rank: Liferay Master

Posts: 543

Join Date: December 29, 2010

Recent Posts

Hi Aneesha,

Your code seems that you are writting code just for testing, not for any specific portlet.
Hook required in order to modify the Existing portlet. And your code seems that you are developing some page with it.

If you checked the mentioned link in your thread, it was for login portlet.

And the code that you has mentioned it will definitely redirect it outside the portlet because it will not load any portlet configuration. It just point to the page which was mentioned by you in the hyperlink.

Thanks & Regards,
Amit Doshi
Aneesha Rao
RE: RenderURL in hooks
July 30, 2012 10:28 PM
Answer

Aneesha Rao

Rank: New Member

Posts: 14

Join Date: February 24, 2012

Recent Posts

Hi Amit,

I am writing this code in the view_users.jsp of directory portlet..
'liferayPortlet' isnothing but 'directory' here.

--Thanks,
Aneesha
Amit Doshi
RE: RenderURL in hooks
July 31, 2012 12:12 AM
Answer

Amit Doshi

Rank: Liferay Master

Posts: 543

Join Date: December 29, 2010

Recent Posts

Modify view_users.jsp, in that include your new.jsp.
Aneesha Rao
RE: RenderURL in hooks
July 31, 2012 1:46 AM
Answer

Aneesha Rao

Rank: New Member

Posts: 14

Join Date: February 24, 2012

Recent Posts

Hi Amit,

Thanks for the reply.
Well yes. I can do it using include tag but I would want to do it using liferay renderurl tag.

Could anyone tell me what I am missing here?
P.S:the same can be done directly in custom (normal) portlets without writing NavigationAction.java and struts actions in liferay-hook.xml. I want to do it in hooks..

---Thanks and Regards,
Aneesha
Amit Doshi
RE: RenderURL in hooks
August 1, 2012 12:12 AM
Answer

Amit Doshi

Rank: Liferay Master

Posts: 543

Join Date: December 29, 2010

Recent Posts

Hi Aneesha,

There are other options for including the files.
1) <liferay-util:include page="/html/portlet/new.jsp"></liferay-util:include>
2) you can make it new.jspf file and include in the same way. <%@ include file="/html/portlet/new.jspf" %>

Hope now your problem will get solved.

Thanks & Regards,
Amit Doshi
devaraj s
RE: RenderURL in hooks
January 2, 2013 4:42 AM
Answer

devaraj s

Rank: Regular Member

Posts: 206

Join Date: May 21, 2012

Recent Posts

Amit Doshi:
Hi Aneesha,

Your code seems that you are writting code just for testing, not for any specific portlet.
Hook required in order to modify the Existing portlet. And your code seems that you are developing some page with it.

If you checked the mentioned link in your thread, it was for login portlet.

And the code that you has mentioned it will definitely redirect it outside the portlet because it will not load any portlet configuration. It just point to the page which was mentioned by you in the hyperlink.

Thanks & Regards,
Amit Doshi


Hi amit,,

I have a requirement that need to modify alerts/announcement portlet .. If user clicks on alerts title, it should take him to perticular news content.. so for that i need to add another jsp that should show only perticular news content..

by refering above link i succeded to render to my sample my page jsp.. but as you mentioned By hook it will not take any portlet configuration it just point to the page..

my question is, if i move to develop my jsp to print news content whether that absense of portlet configuration affect to show news content??

plz let me know.. thanks in advance
Amit Doshi
RE: RenderURL in hooks
January 16, 2013 11:15 PM
Answer

Amit Doshi

Rank: Liferay Master

Posts: 543

Join Date: December 29, 2010

Recent Posts

devaraj s:
Amit Doshi:
Hi Aneesha,

Your code seems that you are writting code just for testing, not for any specific portlet.
Hook required in order to modify the Existing portlet. And your code seems that you are developing some page with it.

If you checked the mentioned link in your thread, it was for login portlet.

And the code that you has mentioned it will definitely redirect it outside the portlet because it will not load any portlet configuration. It just point to the page which was mentioned by you in the hyperlink.

Thanks & Regards,
Amit Doshi


Hi amit,,

I have a requirement that need to modify alerts/announcement portlet .. If user clicks on alerts title, it should take him to perticular news content.. so for that i need to add another jsp that should show only perticular news content..

by refering above link i succeded to render to my sample my page jsp.. but as you mentioned By hook it will not take any portlet configuration it just point to the page..

my question is, if i move to develop my jsp to print news content whether that absense of portlet configuration affect to show news content??

plz let me know.. thanks in advance


Your question answer was very nicely explained in this link.
Let me know if any doubts.
devaraj s
RE: RenderURL in hooks
January 17, 2013 12:47 AM
Answer

devaraj s

Rank: Regular Member

Posts: 206

Join Date: May 21, 2012

Recent Posts

Thanks for the response Amit. I got the solution some days before by the same link.