掲示板

RenderURL in hooks

thumbnail
11年前 に Aneesha Rao によって更新されました。

RenderURL in hooks

New Member 投稿: 14 参加年月日: 12/02/24 最新の投稿
Hi,

Renderurl in hooks navigates outside the portlet..

I have referred this link

view.jsp

<portlet:renderurl var="AneeVar" portletmode="view">

    <portlet:param name="struts_action" value="/liferayPortlet" />

</portlet:renderurl>

<p><a href="<%= AneeVar %>">RENDER URL LINK</a></p>



NavigateAction.java

package com.infy.myhook.action;

import javax.portlet.PortletConfig;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;

import com.liferay.portal.kernel.struts.BaseStrutsPortletAction;
import com.liferay.portal.kernel.struts.StrutsPortletAction;

public class NavigateAction extends BaseStrutsPortletAction {
    @Override
    public String render(
            StrutsPortletAction originalStrutsPortletAction,
            PortletConfig portletConfig, RenderRequest renderRequest,
            RenderResponse renderResponse)
        throws Exception {

        return "/portlet/liferayPortlet/new.jsp";
    }
}


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

liferay-hook.xml

<hook>
<custom-jsp-dir>/META-INF/custom_jsps</custom-jsp-dir>

	<struts-action>
    <struts-action-path>/liferayPortlet</struts-action-path>
    <struts-action-impl>com.infy.myhook.action.NavigateAction</struts-action-impl>
</struts-action>

</hook>



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

--Thanks and Regards,
Aneesha
thumbnail
11年前 に Amit Doshi によって更新されました。

RE: RenderURL in hooks

Liferay Master 投稿: 550 参加年月日: 10/12/29 最新の投稿
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
thumbnail
11年前 に Aneesha Rao によって更新されました。

RE: RenderURL in hooks

New Member 投稿: 14 参加年月日: 12/02/24 最新の投稿
Hi Amit,

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

--Thanks,
Aneesha
thumbnail
11年前 に Amit Doshi によって更新されました。

RE: RenderURL in hooks

Liferay Master 投稿: 550 参加年月日: 10/12/29 最新の投稿
Modify view_users.jsp, in that include your new.jsp.
thumbnail
11年前 に Aneesha Rao によって更新されました。

RE: RenderURL in hooks

New Member 投稿: 14 参加年月日: 12/02/24 最新の投稿
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
thumbnail
11年前 に Amit Doshi によって更新されました。

RE: RenderURL in hooks

Liferay Master 投稿: 550 参加年月日: 10/12/29 最新の投稿
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
thumbnail
11年前 に devaraj s によって更新されました。

RE: RenderURL in hooks

Regular Member 投稿: 228 参加年月日: 12/05/21 最新の投稿
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
thumbnail
11年前 に Amit Doshi によって更新されました。

RE: RenderURL in hooks

Liferay Master 投稿: 550 参加年月日: 10/12/29 最新の投稿
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.
thumbnail
11年前 に devaraj s によって更新されました。

RE: RenderURL in hooks

Regular Member 投稿: 228 参加年月日: 12/05/21 最新の投稿
Thanks for the response Amit. I got the solution some days before by the same link.