Search code examples
liferayliferay-6

Liferay 6: How to custom display Portals On Successful login


I am using Liferay 6 for development . I have developed a Custom Login Portlet using Struts2 .

I am able to display my Custom Login page , On click of the Submit Button after validating the credentials aganist our MYSQL Databse , please tell me how can i display my 4 other Custom Portlets on entering valid credentials ??

please guide me what is the concept i should refer for this in liferay ( I am using Liferay 6 for development )


Solution

  • Okay, the way I would suggest you do this is by:

    1. adding the 4 other portlets to your Custom Login page (or add a redirect on successful login, and them to the page you redirect to)
    2. Set the permissions of your Custom Portlets to be viewable by only authenticated users. This can be done by removing Guest "View" permissions. This way a non-authenticated user or "Guest" won't see your portlets when the go to the page.

    Does this answer your question?

    ~~ EDIT IN RESPONSE TO COMMENT ~~

    Okay, so if you're using Struts, instead of redirecting to a JSP file, you want to redirect to a URL instead. So instead of /view/result.jsp it should be something like http://yoursite.com/page_with_4_portlets_on_it or just a relative URL /page_with_4_portlets_on_it (if the two pages are on the same Navigation level.

    HOWEVER:

    If you're new to Liferay then I would strongly suggest you use Liferay's inbuilt Portlet architecture using their MVCPortlet class. This will handle all the mappings, and workings that you have to manually write for using Struts. Then you can implement a doPost() method and do a ActionResponse.sendRedirect("/page_with_4_portlets_on_it");

    Then this means that when your form action completes Liferay will redirect the user to the page you've specified.

    The best place to get started with Liferay 6 portlets, the Liferay way is here.