Fórumok

Reg: How to give a hyperlink to a portlet from theme?

Ashok BS, módosítva 10 év-val korábban

Reg: How to give a hyperlink to a portlet from theme?

Junior Member Bejegyzések: 30 Csatlakozás dátuma: 2013.08.26. Legújabb bejegyzések
Hi,

Can anyone help me out, I want to give a hyperlink to a portlet from vm file (my custom theme),But the portlet is under another project.Can anyone provide the source code???
thumbnail
Atin Agarwal, módosítva 10 év-val korábban

RE: Reg: How to give a hyperlink to a portlet from theme?

Junior Member Bejegyzések: 86 Csatlakozás dátuma: 2012.02.20. Legújabb bejegyzések
You can simply make an inter portlet render URL & provide this URL to the hyperlink -

## ---------- Url for custom portlet ---------- ##
#set ($myPortletId = "helloworld_WAR_helloworldportlet") ## your unique portlet id
#set ($myPortletURL = $portletURLFactory.create($request, $myPortletId , $layout.plid, "RENDER_PHASE"))
$myPortletURL.setParameter("jspPage", "/html/hello-world/view.jsp")) ## path to your jsp
$myPortletURL.setWindowState("NORMAL")
$myPortletURL.setPortletMode("view")

<a href="$myPortletURL">Go to my portlet</a>


Regards,
Atin Agarwal
Ashok BS, módosítva 10 év-val korábban

RE: Reg: How to give a hyperlink to a portlet from theme?

Junior Member Bejegyzések: 30 Csatlakozás dátuma: 2013.08.26. Legújabb bejegyzések
Thanks Atin for your response. I have tried the above code, and still it is not working..

my code snippet below :

<span class="selectOption" >
#set ($searchPortletId = "searchemployee_WAR_Testportlet")
#set ($searchPortletURL = $portletURLFactory.create($request, $searchPortletId , $layout.plid, "RENDER_PHASE"))
$searchPortletURL.setParameter("jspPage", "/html/searchemployee/view.jsp")
$searchPortletURL.setWindowState("NORMAL")
$searchPortletURL.setPortletMode("view")
<a href="$myPortletURL" style="text-decoration: none; color: white;">Timesheet Cab Request</a>
</span>

In the above code what 'll be the value of "$layout.plid"? is the above code correct??

Note: My SearchPortlet (my own portlet)is under one project and my theme is another project.Will the above code work if they are two diff projects?

Error message i got :

The requested resource was not found.
http://localhost:8080/web/guest/$myPortletURL
thumbnail
Atin Agarwal, módosítva 10 év-val korábban

RE: Reg: How to give a hyperlink to a portlet from theme?

Junior Member Bejegyzések: 86 Csatlakozás dátuma: 2012.02.20. Legújabb bejegyzések
Ashok BS:
<a href="$myPortletURL" style="text-decoration: none; color: white;">Timesheet Cab Request</a>

Error message i got :

The requested resource was not found.
http://localhost:8080/web/guest/$myPortletURL


Use searchPortletURL in place of myPortletURL -
<a href="$searchPortletURL" style="text-decoration: none; color: white;">Timesheet Cab Request</a>

Apart from this rest of the code is correct. And yes it will work if they are in diff. projects, provided that you have given the correct portlet id.

Regards,
Atin Agarwal
Ashok BS, módosítva 10 év-val korábban

RE: Reg: How to give a hyperlink to a portlet from theme?

Junior Member Bejegyzések: 30 Csatlakozás dátuma: 2013.08.26. Legújabb bejegyzések
Thanks Atin for your quick response,

Sorry it was a typing mistake ..The code was as shown below.But still the hyperlink is not working...
<span class="selectOption" >
#set ($searchPortletId = "searchemployee_WAR_Testportlet")
#set ($searchPortletURL = $portletURLFactory.create($request, $searchPortletId , $layout.plid, "RENDER_PHASE"))
$searchPortletURL.setParameter("jspPage", "/html/searchemployee/view.jsp")
$searchPortletURL.setWindowState("NORMAL")
$searchPortletURL.setPortletMode("view")
<a href="$searchPortletURL" style="text-decoration: none; color: white;">Timesheet Cab Request</a>
</span>

My query :
1. How can I get the proper portlet ID? (I got the portlet ID from Portlet's view.jsp by printing some statements) ,is it correct way?
2.Is the above "$layout.plid " value passed is correct?(I meant should be pass the layout plid value in place of $layout.plid)?

Kindly let me know if I have missed out anything.Thanks in advance.
thumbnail
Atin Agarwal, módosítva 10 év-val korábban

RE: Reg: How to give a hyperlink to a portlet from theme?

Junior Member Bejegyzések: 86 Csatlakozás dátuma: 2012.02.20. Legújabb bejegyzések
Ashok BS:

My query :
1. How can I get the proper portlet ID? (I got the portlet ID from Portlet's view.jsp by printing some statements) ,is it correct way?
2.Is the above "$layout.plid " value passed is correct?(I meant should be pass the layout plid value in place of $layout.plid)?


1. To get the portlet id -
Navigate to Control Panel ----> Plugins Configurations. Under Portlet Plugins tab search for your portlet, clicking on it will open up a config page of your portlet . Plugins Id is what you need.

2. That is correct.

Could you tell me what issue are you facing when you are trying this???
Ashok BS, módosítva 10 év-val korábban

RE: Reg: How to give a hyperlink to a portlet from theme?

Junior Member Bejegyzések: 30 Csatlakozás dátuma: 2013.08.26. Legújabb bejegyzések
Thanks,still I am facing the issue wrt hyperlink.i.e. there is no effect while clicking on hyperlink

My code snippet:
<span class="selectOption" >
line1 #set($searchPortletId = "searchemployee_WAR_Test")
line2 #set ($searchPortletURL = $portletURLFactory.create($request, $searchPortletId , $layout.plid, "RENDER_PHASE"))
line3 $searchPortletURL.setParameter("jspPage", "/html/searchemployee/view.jsp")
line4 $searchPortletURL.setWindowState("NORMAL")
line5 $searchPortletURL.setPortletMode("view")
line6 <a href="$searchPortletURL" style="text-decoration: none; color: white;">Search Employee</a>
</span>

In the above code, I found that if I change line6 to <a href="$searchPortletURL1" style="text-decoration: none; color: white;">Search Employee</a>,
where $searchPortletURL1 is not existing, I am getting below error message:
The requested resource was not found.
http://localhost:8080/web/guest/$myPortletURL1


Where as if I specify <a href="$searchPortletURL" style="text-decoration: none; color: white;">Search Employee</a> which is actual portlet URL,there is no effect at all.
I meant we do not get the above message too by clicking on the hyperlink.So I assume that It is not even calling to the hyperlink.So I am stuck at this point.

Could you please let me know why i am unable to navigate to search portlet when i click on "Search Employee" hyperlink.???
thumbnail
Atin Agarwal, módosítva 10 év-val korábban

RE: Reg: How to give a hyperlink to a portlet from theme?

Junior Member Bejegyzések: 86 Csatlakozás dátuma: 2012.02.20. Legújabb bejegyzések
Ashok BS:

The requested resource was not found.
http://localhost:8080/web/guest/$myPortletURL1



It seems that your theme is not deployed correctly. You should clean and re-deploy your theme.
Because in the error that you are getting, $myPortletURL1 is nowhere used in the code.

Regards,
Atin Agarwal