0
votes

I am using Liferay 6. I have developed a simple Liferay Struts2 Portlet. This portlet got deployed into:

D:\Liferay\Liferay Tomcat\liferay-portal-6.1.0-ce-b4\tomcat-7.0.22\webapps

With the name GreetingPortlet-portlet. This portlet consists of a JSP page called as View.jsp inside the GreetingPortlet-portlet.

Please tell me how can we access this manually, by typing the URL in the browser

In other words, can we access it by typing the following?

http:localhost:8086/GreetingPortlet/view.jsp ??

I am not using any Friendly URL concept.

2
you shouldn't be accessing portlet views directly. you can add your portlet to a page let the container decide what needs to be shown.soulcheck

2 Answers

2
votes

You cannot access a portlet which is just deployed and not added to any page.

  • Portlets are not Servlets, that once you deploy and provide the mapping in the web.xml it would become accessible.
  • In a portal a Page is accessed and not a single portlet. And a portlet is added to a page to function. Unless a portlet is added to the page it can't be accessed.

So what you can do is add your portlet to a Page, you can just add one portlet to the page so that when you go to the page URL you will only see your portlet.

If you don't want that the Users to see the page then you can add a hidden page, so that it can only be accessed if the URL is known and then test your portlet on that page.


Edit (On second thoughts) :-)

As Tobias Liefke pointed out in the comment (Thanks!), we can display content of a particular portlet even though it is not added on any page.

Here is what we can do:

  1. We can have add-default-resource set to true in liferay-portlet.xml for the portlet you want to access, in your case the Greetings-portlet.
  2. You would need to create a render-URL to display your page
  3. If you just want to show the portlet content and not the other stuff which the portal adds like CSS, Dockbar etc, then use exclusive as the Window-state while creating the render-url.
  4. This answer might help, in the answer it is about opening the portlet in a pop-up but would work the same by giving the URL in the browser's address bar.
0
votes

I had the exact sample stupid problem and I couldn't find an answer anywhere. I finally noticed that liferay control panel allows you to install a war file. So I exported my portlet into a war file and then went to liferay control panel->apps and installed it from there and what do you know, it worked. Very frustrating!