Generate link to Liferay root site from Portlet's JSP

dube

I am writing a Portlet, which will be placed on a given liferay site. Liferay can have multiple sites, which can be public or private.

How can I generate a link (in my portlet JSP) to root page of the site in which the portlet was placed? e.g. for the site mySite I expect something like http://localhost:8080/web/mySite/

Those two are not what I need:

themeDisplay.getPortalURL() // "liferay portal web root", not site root
themeDisplay.getURLHome() // default site home, not necessarily my specific site
Alain Dresse

I hope the following meets your needs :

String portalPath = PortalUtil.getPortalURL(themeDisplay);

boolean isPrivateLayout = themeDisplay.getLayout().isPrivateLayout();
Group scopeGroup = themeDisplay.getScopeGroup();
String groupUrl = PortalUtil.getGroupFriendlyURL(scopeGroup,isPrivateLayout,themeDisplay);

String result = portalPath + groupUrl;

Best regards, Alain

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

how to redirect from jsp of one portlet to jsp of another portlet inside liferay module project in liferay 7

From Dev

Modify Liferay's Marketplace portlet

From Dev

Removing session attribute in jsp portlet issue in liferay

From Dev

How to get selected value from drop down list in one jsp to java controller class in liferay portlet references

From Dev

Creating liferay portlet - How to pass data to to myScript.js from Java class via view.jsp

From Dev

Liferay Portlet: How to generate service.xml (service builder) from existing database

From Dev

Liferay: Call JSON service from portlet

From Dev

Change OG metatags from Liferay portlet

From Dev

How to prepare view jsp using Liferay MVC Portlet

From Dev

How to prepare view jsp using Liferay MVC Portlet

From Dev

View only permission for community/site members for Wiki portlet is not working in Liferay

From Dev

How to send sensitive data to a Liferay portlet from outside the Liferay portal

From Dev

How to convert site's document library from Alfresco to Liferay?

From Dev

How to convert site's document library from Alfresco to Liferay?

From Dev

Invoke action of core Liferay's portlet (Document Library) using custom portlet's form

From Dev

Liferay's marketplace-portlet not deployed correctly in version 6.2?

From Dev

liferay use service/class from ext plugin in portlet

From Dev

How to delete a portlet in Liferay 6.1 programmatically from code

From Dev

How to call the content of a jsp into another portlet's jsp

From Dev

Liferay portlet with freemarker and spring

From Dev

passing parameters to a liferay portlet

From Dev

How to refresh a liferay portlet?

From Dev

Customizing liferay Calendar portlet

From Dev

Liferay portlet configuration

From Dev

Existing project as a portlet in Liferay

From Dev

Customizing liferay Calendar portlet

From Dev

passing parameters to a liferay portlet

From Dev

Liferay Search Portlet Customization

From Dev

Liferay: creating a portlet configuration page. How to provide correct jsp path?

Related Related

  1. 1

    how to redirect from jsp of one portlet to jsp of another portlet inside liferay module project in liferay 7

  2. 2

    Modify Liferay's Marketplace portlet

  3. 3

    Removing session attribute in jsp portlet issue in liferay

  4. 4

    How to get selected value from drop down list in one jsp to java controller class in liferay portlet references

  5. 5

    Creating liferay portlet - How to pass data to to myScript.js from Java class via view.jsp

  6. 6

    Liferay Portlet: How to generate service.xml (service builder) from existing database

  7. 7

    Liferay: Call JSON service from portlet

  8. 8

    Change OG metatags from Liferay portlet

  9. 9

    How to prepare view jsp using Liferay MVC Portlet

  10. 10

    How to prepare view jsp using Liferay MVC Portlet

  11. 11

    View only permission for community/site members for Wiki portlet is not working in Liferay

  12. 12

    How to send sensitive data to a Liferay portlet from outside the Liferay portal

  13. 13

    How to convert site's document library from Alfresco to Liferay?

  14. 14

    How to convert site's document library from Alfresco to Liferay?

  15. 15

    Invoke action of core Liferay's portlet (Document Library) using custom portlet's form

  16. 16

    Liferay's marketplace-portlet not deployed correctly in version 6.2?

  17. 17

    liferay use service/class from ext plugin in portlet

  18. 18

    How to delete a portlet in Liferay 6.1 programmatically from code

  19. 19

    How to call the content of a jsp into another portlet's jsp

  20. 20

    Liferay portlet with freemarker and spring

  21. 21

    passing parameters to a liferay portlet

  22. 22

    How to refresh a liferay portlet?

  23. 23

    Customizing liferay Calendar portlet

  24. 24

    Liferay portlet configuration

  25. 25

    Existing project as a portlet in Liferay

  26. 26

    Customizing liferay Calendar portlet

  27. 27

    passing parameters to a liferay portlet

  28. 28

    Liferay Search Portlet Customization

  29. 29

    Liferay: creating a portlet configuration page. How to provide correct jsp path?

HotTag

Archive