Liferay6 开发 环境部署 Liferay6实例(3)

2019-04-22 21:53

Liferay 6 Development Documentation

2. Edit project properties

You can find a file named “portal-ext.properties” in path: /myliferay-ext/docroot/WEB-INF/ext-impl/src a) For JDBC configure: jdbc.default.driverClassName=com.mysql.jdbc.Driver jdbc.default.url=jdbc:mysql://localhost/ecatalogue?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false jdbc.default.username=root jdbc.default.password=123456 b) For Auto creating predefine table and filling initial data: (just use for initial

database in first time) schema.run.enable=true schema.run.minimal=true Liferay 6 Development Documentation

c) Hibernate setting: hibernate.show_sql=true

3. Create a empty Liferay6 schema by the “jdbc.default.url” in properties

e.g.: ecatalogue

4. Change the default build.xml for deployment.

Create a new portlet

1. Before to start the following steps, please do some things first: 1) 2) Create a folder \/myliferay/docroot/WEB-INF/ext-web/docroot/html/portlet/product Create a folder \/myliferay/docroot/WEB-INF/ext-impl/src/content, then create a file name \Language-ext_en.properties\3) Copy liferay-display.xml from Liferay Tomcat installed path liferay-portal-tomcat-6.0.5\\${TOMCAT_HOME}\\webapps\\ROOT\\WEB-INF to /myliferay/docroot/WEB-INF/ext-web/docroot/WEB-INF

2. Create a Java Action file in this path:

File path:

/myliferay/docroot/WEB-INF/ext-impl/src/com/accentrix/ecatalog/action/PortletAction.java /** * */ package com.accentrix.ecatalog.action; import javax.portlet.ActionRequest; import javax.portlet.ActionResponse; import javax.portlet.PortletConfig; import javax.portlet.RenderRequest; import javax.portlet.RenderResponse; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; Liferay 6 Development Documentation

import com.liferay.portal.struts.PortletAction; /** * @author tom.wu * */ public class ProductAction extends PortletAction { public ActionForward render(ActionMapping mapping, ActionForm form, } }

PortletConfig config, RenderRequest req, RenderResponse res) throws Exception { if (getForward(req) != null && !getForward(req).equals(\ return mapping.findForward(getForward(req)); } else { } return mapping.findForward(\3. Create a JSP file

File path: /myliferay/docroot/WEB-INF/ext-web/docroot/html/portlet/product/products.jsp <%@ include file=\%> This is theProduct Listportlet.

4. Struts xml file setting

File path: /myliferay/docroot/WEB-INF/ext-web/docroot/WEB-INF/struts-config-ext.xml

5. Tiles xml setting

File path: /myliferay/docroot/WEB-INF/ext-web/docroot/WEB-INF/tiles-defs-ext.xml Liferay 6 Development Documentation

6. Portlet-ext.xml setting

File path: /myliferay/docroot/WEB-INF/ext-web/docroot/WEB-INF/portlet-ext.xml

product

product display name com.liferay.portlet.StrutsPortlet

view-action

/productportlet/demo

0

text/html

com.liferay.portlet.StrutsResourceBundle

power-user

user

7. Liferay-portlet-ext.xml setting

File path:/myliferay/docroot/WEB-INF/ext-web/docroot/WEB-INF/liferay-portlet-ext.xml product productportlet false Liferay 6 Development Documentation

8. Liferay-display.xml setting

File path: /myliferay/docroot/WEB-INF/ext-web/docroot/WEB-INF/liferay-display.xml ……… ……

9. Language-ext_en.properties setting

File path: /myliferay-ext/docroot/WEB-INF/ext-impl/src/content/Language-ext_en.properties

javax.portlet.title.product = My Product Portlet

Compiling & Deploying portlet

Now we can deploy the basic configuration, run ant to deploy /myliferay/build.xml

Start the tomcat server and open in browser http://localhost:8080/

Notice: http://127.0.0.1:8080/ may not work in Firefox.

5. Table Maintenance Portlet

Development

We will create a table and coding in this part.

1. Create example table in MySql

CREATE TABLE product ( uuid char(36) NOT NULL,


Liferay6 开发 环境部署 Liferay6实例(3).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:岗位手册-制单员(展厅)

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: