You can not run a portlet in a Tomcat. You need to have a Portal container (just like servlets needs a servlet container, A portlet needs a portlet container). There are so many open source implementations of Portal containers available like Liferay portal, JBOSS Portal , Jetspeed ..etc.
If you want to run only on Tomcat, then download "Liferay bundled with tomcat" from Liferay website. Its easy to configure and run.
To develop a portlet in eclipse, you can install the portal pack plugin for eclipse. I dont remember the url but you can search in google for "eclipse-portal-pack" easily.
In "LiferyaBundle with tomcat", the liferay product is integrated as default web application inside tomcat container (in /ROOT). You can also deploy your web applications inside the tomcat and access with your context path.
But to access your web application pages, inside a portal page, you need to have a portlet. The portlet should access your application (cross-context).
In the portlet doView() method , generally we'll dispatch the request to a jsp page (view.jsp). From view.jsp, you can redirect to your webapplication .
You deploy the war file of your webapplication in the tomcat(or any server) where the Liferay is running. Now from your portlet (view.jsp), you can access the content of your webapp using cross context include like <c:import url="relative url to your webapplication resource" context="your webapplication context name" />
For this, you need to enable cross context for your portlet war file in the tomcat server.xml as shown below :
Assume that your JSR portlet is deployed in Liferay as MyFirstPortlet.war file and your webapplication (servlets and JSP) is deployed as "MyWeb.war"
Suppose you have a TestMe.jsp in MyWeb.war and you need to access this inside the portlet, Then, in your portlet (view.jsp),
This is a very basic example. Hope this is what your requirement is .
By default Tomcat will not allow access to the resources of one web application in the other web application. We need to mention in the server.xml (TOMCAT/conf/) file for which web application we want to enable this cross context access.
Here I am trying to access a jsp of another web application in my portlet (my portlet is also a WAR file), so added that entry in the server.xml (before closing tag of </HOST>).
I'll send you both the war files.
I assume that you know how to deploy a portlet war file in liferay. You can simply copy the portlet war file into the hot deployment directory (on windows it is <your home dir>/liferay/deploy). If you start the tomcat, the liferay will pick this war file automatically. Thus you can deploy your portlets dynamically.
I would really appreciate it if you can send me a copy of the web application to my email id as well. I have been trying to do this since a couple of days. Had no luck.
MY email id is
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop