Steps
to create first Jsp in Liferay6.0
- Download liferay-portal-src-6.0.1.zip from the liferay website and save it in workspace>portal>(list of files from the zip)
- Create new app.server.harshal.properties in workspace>portal as
app.server.type=tomcat
app.server.zip.name=C:/Liferay6.0/apache-tomcat-6.0.26.zip
ext.work.dir=C:/Liferay6
app.server.dir=C:/Liferay6/apache-tomcat-6.0.26
app.server.tomcat.dir=C:/Liferay6/apache-tomcat-6.0.26
app.server.tomcat.bin.dir=C:/Liferay6/apache-tomcat-6.0.26/bin
app.server.tomcat.classes.global.dir=C:/Liferay6/apache-tomcat-6.0.26/lib
app.server.tomcat.classes.portal.dir=${app.server.tomcat.portal.dir}/WEB-INF/classes
app.server.tomcat.deploy.dir=C:/Liferay6/apache-tomcat-6.0.26/webapps
app.server.tomcat.lib.endorsed.dir=C:/Liferay6/apache-tomcat-6.0.26/lib/ext
app.server.tomcat.lib.global.dir=C:/Liferay6/apache-tomcat-6.0.26/lib/ext
app.server.tomcat.lib.portal.dir=${app.server.tomcat.portal.dir}/WEB-INF/lib
app.server.tomcat.lib.support.dir=C:/Liferay6/apache-tomcat-6.0.26/lib/ext
app.server.tomcat.portal.context=ROOT
app.server.tomcat.portal.dir=${app.server.tomcat.deploy.dir}/${app.server.tomcat.portal.context}
app.server.tomcat.log.dir=C:/Liferay6/apache-tomcat-6.0.26/logs
app.server.tomcat.temp.dir=C:/Liferay6/apache-tomcat-6.0.26/temp
app.server.tomcat.work.dir=C:/Liferay6/apache-tomcat-6.0.26/work
app.server.tomcat.zip.name=apache-tomcat-6.0.26.zip
app.server.tomcat.zip.url=http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.26/bin/${app.server.tomcat.zip.name}
- Set build.harshal.properties as
ant.build.javac.source=1.6
ant.build.javac.target=1.6
- Set release.harshal.properties as
lp.ext.dir=C:/Liferay6/workspace/ext
- Find ${user.name} and replace it with harshal
- Place apache-tomcat-6.0.26.zip in workspace.
- And unzip apache-tomcat-6.0.26 in workspace.
- From build of portal and double click on clean,start,deploy target.
- Star t tomcat liferay should start.
- Download liferayplugin6.0.zip and place it in the workspace.
- Find ${user.name} and replace it with harshal
- Create a build.harshal.properties as
ant.build.javac.source=1.6
ant.build.javac.target=1.6
app.server.type=tomcat
app.server.zip.name=C:/Liferay6/apache-tomcat-6.0.26.zip
ext.work.dir=C:/Liferay6
app.server.dir=C:/Liferay6/apache-tomcat-6.0.26
- From command prompt go to workspace>pluginsdk>ext and > create hello-world “Hello World”.
- Go to C:\Liferay6\workspace\pluginsdk\ext\first-ext\docroot\WEB-INF\ext-web\docroot
And create view.jsp as
<%@
taglib
uri="http://java.sun.com/portlet_2_0"
prefix="portlet"
%>
<portlet:defineObjects
/>
This
is the <b>hello</b>.
- Go to C:\Liferay6\workspace\pluginsdk\ext\first-ext\docroot\WEB-INF\ext-web\docroot\WEB-INF and create liferay-display-ext.xml
<?xml
version="1.0"?>
<!DOCTYPE
display
PUBLIC
"-//Liferay//DTD
Display 6.0.0//EN"
"http://www.liferay.com/dtd/liferay-display_6_0_0.dtd">
<display>
<category
name="new">
<portlet
id="jsp_portlet"
/>
</category>
</display>
Go to
C:\Liferay6\workspace\pluginsdk\ext\first-ext\docroot\WEB-INF\ext-web\docroot\WEB-INF
and edit “ liferay-portlet-ext.xml”
<?xml
version="1.0"?>
<!DOCTYPE
liferay-portlet-app
PUBLIC
"-//Liferay//DTD
Portlet Application 6.0.0//EN"
"http://www.liferay.com/dtd/liferay-portlet-app_6_0_0.dtd">
<liferay-portlet-app>
<portlet>
<portlet-name>jsp_portlet</portlet-name>
</portlet>
</liferay-portlet-app>
- Go to C:\Liferay6\workspace\pluginsdk\ext\first-ext\docroot\WEB-INF\ext-web\docroot\WEB-INF and edit portlet-ext.xml
<?xml
version="1.0"?>
<portlet-app
version="2.0"
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
>
<portlet>
<portlet-name>jsp_portlet</portlet-name>
<display-name>jsp_portlet</display-name>
<portlet-class>com.liferay.util.bridges.mvc.MVCPortlet</portlet-class>
<init-param>
<name>view-jsp</name>
<value>/view.jsp</value>
</init-param>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
</supports>
<portlet-info>
<title>jsp_portlet</title>
<short-title>jsp_portlet</short-title>
<keywords>jsp_portlet</keywords>
</portlet-info>
<security-role-ref>
<role-name>administrator</role-name>
</security-role-ref>
<security-role-ref>
<role-name>guest</role-name>
</security-role-ref>
<security-role-ref>
<role-name>power-user</role-name>
</security-role-ref>
<security-role-ref>
<role-name>user</role-name>
</security-role-ref>
</portlet>
</portlet-app>
- Go to C:\Liferay6\workspace\pluginsdk\ext\first-ext>ant compile
- C:\Liferay6\workspace\pluginsdk\ext\first-ext>ant deploy
- C:\Liferay6\workspace\pluginsdk\ext\first-ext>ant war
- Copy this hello-world.war from pluginsdk\dist> folder and place it into deloy folder.
- Start the tomcat server.
- Wait till the server says Extension environment for hello portal has been applied.
- Folder structure is like this
C:>Liferay6.0>
Workspace>
Portal>
PluginSDK>
apache-tomcat-6.0.26>
deploy>
data>
apache-tomcat-6.0.26.zip>
Troubleshooting:
Sometimes you will get zip exception.
Go to tomcat>lib>ext folder and delete file ext-service..jar
file.
Restart Tomcat.
No comments:
Post a Comment