Liferay Portal6安装及简单设置

合集下载

Liferay Portal 6.1源码导入到eclipse

Liferay Portal 6.1源码导入到eclipse

Liferay Portal 6.1源码部署到eclipsecontribute:湖北红安shimanandate:2012/9/26一:下载文件。

进入网站/downloads/liferay-portal/available-releases,下载文件:1、Bundled with Tomcat下载地址:/projects/lportal/files/Liferay%20Portal/6.1.1%2 0GA2/liferay-portal-tomcat-6.1.1-ce-ga2-20120731132656558.zip/dow nload对应文件:liferay-portal-tomcat-6.1.1-ce-ga2-20120731132656558.zip 2、Portal Source下载地址:/projects/lportal/files/Liferay%20Portal/6.1.1%2 0GA2/liferay-portal-src-6.1.1-ce-ga2-20120731132656558.zip/downloa d对应文件:liferay-portal-src-6.1.1-ce-ga2-20120731132656558.zip 3、PluginsSdk下载地址:/projects/lportal/files/Liferay%20Portal/6.1. 1%20GA2/liferay-plugins-sdk-6.1.1-ce-ga2-20120731132656558.zip/do wnload对应文件:liferay-plugins-sdk-6.1.1-ce-ga2-20120731132656558.zip4、Liferay IDE 1.6.0下载地址:/projects/lportal/files/Liferay%20IDE/1.6.0/eclipse_Liferay_IDE_1.6.0.v 201207162359-win32.zip/download对应文件:eclipse_Liferay_IDE_1.6.0.v201207162359-win32.zip二、安装准备工作(此部分请参考网上有详细教程)1、jdk安装及环境搭建下载地址:/otn-pub/java/jdk/7u7-b11/jdk-7u7-windows-i586.exe,下载文件jdk-7u7-windows-i586.exe,双击安装,我安装路径为:D:\Java\jdk1.7.0_07,设置环境变量:JAVA_HOME 为:D:\Java\jdk1.7.0_07,path中添加:%JAVA_HOME%\bin; CLASSPATH 为:.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\toos.jar;2、ant安装及环境搭建下载地址:/dist/ant/binaries/apache-ant-1.8.4-bin.zip下载文件:apache-ant-1.8.4-bin.zip,后解压,我解压到D:\apache-ant-1.8.4,设置环境变量:ANT_HOME为D:\apache-ant-1.8.4,path中添加:%ANT_HOME%\bin;%ANT_HOME%\lib3、安装mysql(略),请从网上查找相关资料。

Liferay6 开发 环境部署 Liferay6实例

Liferay6 开发 环境部署 Liferay6实例

Liferay6Development DocumentationTABLE OF CONTENTS1.PREFACE (2)W HAT'S COVERED (2)P REREQUISITE SOFTWARE (2)A SSUMPTION (3)2.LIFERAY INSTALLATION AND CONFIGURATION (3)D OWNLOAD (3)JDK1.6I NSTALLATION (3)M Y SQL I NSTALLATION (3)T OMCAT 6 INSTALLATION AND CONFIGURATION (4)3.LIFERAY 6 DEVELOPMENT ENVIRONMENT SETUP (6)4.DEVELOPING & DEPLOYING CUSTOM PORTLET TO LIFERAY 6 (10)L IFERAY EXTEND STRUCTURE ....................................................................... 错误!未定义书签。

C REATE A NEW EMPTY L IFERAY PROJECT (10)C REATE A NEW PORTLET (12)C OMPILING &D EPLOYING PORTLET (15)5.TABLE MAINTENANCE PORTLET DEVELOPMENT (15)6.FAQ(FREQUENT ASKED QUESTIONS) (35)7.APPENDIX (36)1.PrefaceThis guide was written as a quick reference to getting started developing on the Liferay Portal 6 platform (non-bundled) for Java developer step by step.What's coveredThe following list details all of the various parts of the documentation that are covered over the course of the tutorial.Preparation, development environment setupThe basic portlet development & deployment.Logic code with MySqlPrerequisite softwareThe following prerequisite software and environment setup is assumed. You should also be reasonably comfortable using the following technologies.Java SDK 1.5+Liferay Portal 6Eclipse 3.6Ant 1.7Apache Tomcat 6.0.14MySqlAssumptionMySQL is installed2.Liferay installation and configuration DownloadDownload Liferay 6 war & sdk file from websiteWar:/projects/lportal/files/Liferay%20Portal/6.0.5/liferay-portal-6.0.5.war/downloadDependency file:/projects/lportal/files/Liferay%20Portal/6.0.5/liferay-portal-dep endencies-6.0.5.zip/downloadSDK: /downloads/Tomcat 6: /download-60.cgi ()Now we have 4 files:apache-tomcat-6.0.20.zipliferay-portal-6.0.5.war,liferay-plugins-sdk-6.0.5.zipliferay-portal-dependencies-6.0.5.zipJDK 1.6 InstallationRefer to:/technetwork/java/javase/documentation/install-windows-15 2927.htmlMySQL InstallationRefer to:/doc/refman/5.1/en/windows-install-wizard.html Tomcat 6 installation and configuration1.Unpack apache-tomcat-6.0.20.zip to your prefer directory such asC:\java\tomcat60.From now on, we shall call this path as ${TOMCAT_HOME}.Notice: we are using non-install version.2.Create and edit ${TOMCAT_HOME}/conf/Catalina/localhost/ROOT.xml3.4.Make sure your database server is installed and is working. If it's installedin a different machine, make sure that it's accessible from the one where Liferay is being installed.5.Make sure the JDBC driver for your database is accessible by Tomcat. Wewill use MySQL as database, please copy connector-java-{$version}-bin.jar to ${TOMCAT_HOME}/lib/extDownload url:/downloads/mirror.php?id=13520#mirrors6.JNDI configure, editappropriate fields above.Notice:1)You need to create a file name portal-ext.properties, the following steps willtalk about this.2)Copy jta.jar/mysql-connector-java-x.x.xx-bin.jar to${TOMCAT_HOME}/lib/ext7.Create a mail session bound to mail/MailSession. Edit${TOMCAT_HOME}/conf/Catalina/localhost/ROOT.xml and configure8.9.10.Edit ${TOMCAT_HOME}/bin/catalina.bat that Tomcat can reference the11.Delete contents ${TOMCAT_HOME}/webapps/ROOT directory. Thisundeploys the default Tomcat home page.12.Unpack liferay-portal-6.0.5.war to ${TOMCAT_HOME}/webapps/ROOT.13.Create and edit14.For supporting UTF-8 URI Encoding, edit15.Run Tomcat,point browser to http://localhost:8080. You should see thedefault Liferay home page.3.Liferay 6 development environment setup1.Eclipse 3.6 installAfter you download eclipse-jee-helios-SR1-win32.zip, unzip it to yourprefer folder or some places like c:\java\eclipse, double click eclipse.exeyou will start eclipse.2.Change the encoding for you entire workspaceAfter start eclipse, go to Preferences>General>Workspace and select UTF-8 as the Text File Encoding. This should set the encoding for all the resources in yourworkspace. Any components you create from now on using the default encoding should all match.3.Unzip the Liferay SDK to your prefer directory such as C:\liferay.Go to C:\liferay\liferay-plugins-sdk-6.0.5, create a file namedbuild.{username}.properties({username} means the name of your computer)4.5.Download Liferay6 plugin SDKSRun eclipse , click Help -> Install New Software -> Available Software Sites -> Add /tools/ide/eclipse/helios/stableClick OK button6.Checked the “Liferay Tools” site from the selection box tree(About 10minutes)7.Click next and then click Finish to begin the installing (About 15 minutes).Eclipse will ask to restart when install completed, please restart it.8.Installing Liferay6 plug-in SDKClick Window -> Preferences -> Liferay,a)Clic k “Configure installed Liferay Plugin SDKs”, then click “Add” buttonChoose you Liferay SDK installed directory such as C:\liferay\liferay-plugins-sdk-6.0.5, click “OK” buttonb)Click “Create a new Liferay runtime environment”, choose “Liferay v6.0 CE (Tomcat 6)”Click next, finished the installing.c)Click “Create a new Liferay server”Click “Finish” button completed the installing.4.Developing & Deploying Custom Portlet to Liferay 6Create a new empty Liferay project1.Create a new Liferay projectClick File -> New -> Other -> Liferay -> Liferay Plug-in Project,Click next,Input your project name: myliferayand click”Ext” as plug-in type, click finish.Once you have created the project successfully, the following directories will auto created:2.Edit project propertiesYou can find a file named “portal-ext.properties” in path:/myliferay-ext/docroot/WEB-INF/ext-impl/srcb)For Auto creating predefine table and filling initial data: (just use for initial3.Create a empty Liferay6 schema by the “jdbc.default.url” in propertiese.g.: ecatalogue4.Create a new portlet1.2.Create a Java Action file in this path:File path:3.Create a JSP file4.Struts xml file setting5.Tiles xml setting6.Portlet-ext.xml settingFile path: /myliferay/docroot/WEB-INF/ext-web/docroot/WEB-INF/portlet-ext.xml <?xml version="1.0"?><portlet-app><portlet><portlet-name>product</portlet-name><display-name>product display name</display-name> <!-- No use for others --><portlet-class>com.liferay.portlet.StrutsPortlet</portlet-class><init-param><name>view-action</name><value>/productportlet/demo</value></init-param><expiration-cache>0</expiration-cache><supports><mime-type>text/html</mime-type></supports><resource-bundle>com.liferay.portlet.StrutsResourceBundle</resource-bundle> <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>7.Liferay-portlet-ext.xml setting8.Liferay-display.xml settingnguage-ext_en.properties settingFile path: /myliferay-ext/docroot/WEB-INF/ext-impl/src/content/Language-ext_en.propertiesCompiling & Deploying portletNow we can deploy the basic configuration, run ant to deploy/myliferay/build.xmlStart the tomcat server and open in browserhttp://localhost:8080/Notice: http://127.0.0.1:8080/ may not work in Firefox.5.Table Maintenance Portlet DevelopmentWe will create a table and coding in this part.1.Create example table in MySql2.Create product_service.xml to generate source codeFile path:/myliferay/docroot/WEB-INF/ext-impl/src/com/accentrix/ecatalog/product/product_service.3.Create build.xml for to run the product_service.xmlRun the build file auto generate source code under below path:/myliferay/docroot/WEB-INF/ext-impl/src/com/accentrix/ecatalog/product/model/impl/myliferay/docroot/WEB-INF/ext-impl/src/com/accentrix/ecatalog/product/service/base/myliferay/docroot/WEB-INF/ext-impl/src/com/accentrix/ecatalog/product/service/impl/myliferay/docroot/WEB-INF/ext-impl/src/com/accentrix/ecatalog/product/service/persistenceNotice:a)Please noted that path must be right, otherwise will not create successfully.b)Since this class is auto generated, you should never modify it, or your changes will beoverwritten the next time you run Service Builder. Instead, all custom code should be placedin XXXLocalServiceImpl.4.Add a method to the service layer.Add the following method to to ProductLocalServiceImpl.javaFile path:/myliferay-ext/docroot/WEB-INF/ext-impl/src/com/accentrix/ecatalog/product/service/impl/ ProductLocalServiceImpl.javapackage com.accentrix.ecatalog.product.service.impl;import java.util.List;import com.accentrix.ecatalog.product.model.Product;import com.accentrix.ecatalog.product.service.base.ProductLocalServiceBaseImpl;import com.liferay.portal.kernel.exception.SystemException;/*** @author tom.wu**/public class ProductLocalServiceImpl extends ProductLocalServiceBaseImpl {public List<Product> findByName(String name, int start, int end) throws SystemException {List<Product> list = productPersistence.findByName(name, start, end);return list;}public int countByName(ng.String name) throws SystemException {int count = productPersistence.countByName(name);return count;}}5.Add ProductSearch.java for search resultFile path:/myliferay-ext/docroot/WEB-INF/ext-impl/src/com/accentrix/ecatalog/product/action/ProductSearch.javaimport java.util.HashMap;import java.util.List;import java.util.Map;import javax.portlet.PortletRequest;import javax.portlet.PortletURL;import com.accentrix.ecatalog.product.model.Product;import com.liferay.portal.kernel.dao.search.SearchContainer;import com.liferay.portlet.enterpriseadmin.search.RoleDisplayTerms;/*** @author tom.wu**/public class ProductSearch extends SearchContainer<Product> {static List<String> headerNames = new ArrayList<String>();static Map<String, String> orderableHeaders = new HashMap<String, String>();static {headerNames.add("name");headerNames.add("qty");headerNames.add("comment");}public static final String EMPTY_RESULTS_MESSAGE = "no-products-were-found";public ProductSearch(PortletRequest portletRequest, PortletURL iteratorURL) {super(portletRequest, new RoleDisplayTerms(portletRequest), new ProductSearchTerms(portletRequest), DEFAULT_CUR_PARAM, DEFAULT_DELTA, iteratorURL, headerNames, EMPTY_RESULTS_MESSAGE);}}6.Create ProductSearchTerms.java for search term query.File path:/myliferay-ext/docroot/WEB-INF/ext-impl/src/com/accentrix/ecatalog/product/action/Productimport com.liferay.portal.kernel.dao.search.DAOParamUtil;import com.liferay.portal.kernel.dao.search.DisplayTerms;/*** @author tom.wu**/public class ProductSearchTerms extends DisplayTerms {public static final String NAME = "name";public String name;public ProductSearchTerms(PortletRequest portletRequest) {super(portletRequest);// name = ParamUtil.getString(portletRequest, NAME);name = DAOParamUtil.getLike(portletRequest, NAME);}public String getName() {return name;}public void setName(String name) { = name;}}7.Update ProductAction.java (already added in second part)File path:/myliferay-ext/docroot/WEB-INF/ext-impl/src/com/accentrix/ecatalog/product/action/Productimport javax.portlet.RenderResponse;import javax.portlet.WindowState;import org.apache.struts.action.ActionForm;import org.apache.struts.action.ActionForward;import org.apache.struts.action.ActionMapping;import com.accentrix.ecatalog.product.model.Product;import com.accentrix.ecatalog.product.service.ProductLocalServiceUtil;import com.liferay.portal.kernel.dao.search.ResultRow;import com.liferay.portal.kernel.util.ParamUtil;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 {// search term,return all result if name is nullString name = ParamUtil.getString(req, "name");PortletURL portletURL = res.createRenderURL();portletURL.setWindowState(WindowState.MAXIMIZED);portletURL.setParameter("struts_action", "/productportlet/demo");portletURL.setParameter("name", name);// set table headerProductSearch searchContainer = new ProductSearch(req, portletURL);searchContainer.setDeltaConfigurable(false);ProductSearchTerms searchTerms = (ProductSearchTerms) searchContainer.getSearchTerms();List results = ProductLocalServiceUtil.findByName(searchTerms.getName(), searchContainer.getStart(), searchContainer.getEnd());int total = ProductLocalServiceUtil.countByName(searchTerms.getName());searchContainer.setTotal(total);searchContainer.setResults(results);List resultRows = searchContainer.getResultRows();req.setAttribute("searchContainer", searchContainer);for (int i = 0; i < results.size(); i++) {Product product = (Product) results.get(i);ResultRow row = new ResultRow(product, product.getUuid(), i);PortletURL rowURL = res.createRenderURL();rowURL.setWindowState(WindowState.MAXIMIZED);rowURL.setParameter("struts_action", "/productportlet/edit");rowURL.setParameter("redirect", searchContainer.getIteratorURL().toString());rowURL.setParameter("uuid", String.valueOf(product.getUuid()));String productName = product.getName();if (productName.length() > 10) {productName = productName.substring(0, 10) + "...";}row.addText(productName, rowURL);// namerow.addText(product.getQty() + "", rowURL);// qtyrow.addText(product.getComment(), rowURL);// commentresultRows.add(row);}if (getForward(req) != null && !getForward(req).equals("")) {return mapping.findForward(getForward(req));} else {return mapping.findForward("products");}}}8.Update products.jspFile path:/myliferay-ext/docroot/WEB-INF/ext-web/docroot/html/portlet/product/products.jsp</portlet:renderURL><aui:form action="<%= searchURL %>" method="post" name="productForm" onSubmit='<%= renderResponse.getNamespace() + "search();" %>'><aui:input name="productUuids" type="hidden" /><!-- for delete function --><aui:fieldset><aui:input inlineField="true" label="Name:" name="name" size="30" value="<%=name%>" /><aui:input align="absmiddle" border="0" inlineField="true" label="" name="search" src='<%= themeDisplay.getPathThemeImages() + "/common/search.png" %>' title="search" type="image" /></aui:fieldset><aui:button-row><aui:button type="submit" value="search" /><aui:button onClick='<%= renderResponse.getNamespace() + "addProduct();" %>' type="button"value='<%= LanguageUtil.format(pageContext, "Add Product", company.getName(), false) %>' /></aui:button-row><div class="separator"></div><liferay-ui:search-iterator searchContainer="${searchContainer}" paginate="<%= false %>" /><liferay-ui:search-paginator searchContainer="<%= searchContainer %>" /></aui:form></div><aui:script>function <portlet:namespace />addProduct() {document.<portlet:namespace/>productForm.action="<portlet:actionURLwindowState="<%=WindowState.MAXIMIZED.toString()%>"><portlet:param name="redirect" value="<%= currentURL %>" /><portlet:param name="struts_action" value="/productportlet/add" /></portlet:actionURL>";document.<portlet:namespace />productForm.submit();}function <portlet:namespace />search() {document.<portlet:namespace />productForm.submit();}</aui:script>Okay, the search function finished.9.Add ProductAddAction.javaFile path:/myliferay-ext/docroot/WEB-INF/ext-impl/src/com/accentrix/ecatalog/product/action/Product AddAction.java*/package com.accentrix.ecatalog.product.action;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;import com.liferay.portal.struts.PortletAction;/*** @author tom.wu**/public class ProductAddAction extends PortletAction {public ActionForward render(ActionMapping mapping, ActionForm form, PortletConfig config, RenderRequest req, RenderResponse res) throws Exception {return mapping.findForward("product.add");}}10.Update struts-config-ext.xml11.Update tiles-defs-ext.xml12.Add product_add.jspFile path:/myliferay-ext/docroot/WEB-INF/ext-web/docroot/html/portlet/product/product_add.jsp13.Save productFile path:/myliferay-ext/docroot/WEB-INF/ext-impl/src/com/accentrix/ecatalog/product/action/Product SaveAction.java/****/package com.accentrix.ecatalog.product.action;import javax.portlet.ActionRequest;import javax.portlet.ActionResponse;import javax.portlet.PortletConfig;import javax.portlet.PortletRequest;import javax.portlet.WindowState;import org.apache.struts.action.ActionForm;import org.apache.struts.action.ActionMapping;import com.accentrix.ecatalog.product.model.Product;import com.accentrix.ecatalog.product.model.impl.ProductImpl;import com.accentrix.ecatalog.product.service.ProductLocalServiceUtil;import com.liferay.portal.kernel.servlet.SessionErrors;import com.liferay.portal.struts.PortletAction;import com.liferay.portal.theme.ThemeDisplay;import com.liferay.portal.util.WebKeys;import com.liferay.portlet.ActionRequestImpl;import com.liferay.portlet.PortletURLImpl;/*** @author tom.wu**/public class ProductSaveAction extends PortletAction {@Overridepublic void processAction(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {try {// If you need validation,add the checking code here.// if (1 == 1) {// throw new Exception("............");// }Form fm = (Form) form;Product product = new ProductImpl();product.setName(fm.getName());product.setQty(fm.getQty());product.setComment(fm.getComment());ProductLocalServiceUtil.addProduct(product);} catch (Exception e) {SessionErrors.add(actionRequest, e.getClass().getName());setForward(actionRequest, "product.error");return;// required,otherwise will continue to next line}String url = this.getRedirctURL(portletConfig, actionRequest);super.sendRedirect(actionRequest, actionResponse, url);}protected String getRedirctURL(PortletConfig portletConfig, ActionRequest actionRequest) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);PortletURLImpl portletURL = new PortletURLImpl((ActionRequestImpl) actionRequest, portletConfig.getPortletName(), themeDisplay.getPlid(), PortletRequest.RENDER_PHASE);portletURL.setWindowState(WindowState.MAXIMIZED);portletURL.setParameter("struts_action", "/productportlet/demo");return portletURL.toString();}public static class Form extends ActionForm {private String uuid;private String name; // product nameprivate int qty;private String comment;public String getUuid() {return uuid;}public void setUuid(String uuid) {this.uuid = uuid;}public String getName() {return name;}public void setName(String name) { = name;}public int getQty() {return qty;}public void setQty(int qty) {this.qty = qty;}public String getComment() {return comment;}public void setComment(String comment) {ment = comment;}}}Deploy & restart server, we can test the add product function.14.Add ProductEditAction.javaFile path:/myliferay-ext/docroot/WEB-INF/ext-impl/src/com/accentrix/ecatalog/product/action/ProductEditAction.java/****/package com.accentrix.ecatalog.product.action;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;import com.accentrix.ecatalog.product.model.Product;import com.accentrix.ecatalog.product.service.ProductLocalServiceUtil;import com.liferay.portal.kernel.util.ParamUtil;import com.liferay.portal.struts.PortletAction;/*** @author tom.wu**/public class ProductEditAction extends PortletAction {public ActionForward render(ActionMapping mapping, ActionForm form, PortletConfig config, RenderRequest req, RenderResponse res) throws Exception {String uuid = ParamUtil.getString(req, "uuid");// productif (uuid != null) {Product product = ProductLocalServiceUtil.getProduct(uuid);req.setAttribute("product", product);}return mapping.findForward("product.edit");}}15.Add product edit JSPFile path:/myliferay-ext/docroot/WEB-INF/ext-web/docroot/html/portlet/product/product_edit.jspProduct product = (Product) request.getAttribute("product");%><portlet:actionURL var="saveURL"><portlet:param name="struts_action" value="/productportlet/update" /></portlet:actionURL><aui:form action="<%= saveURL %>" method="post" name="productForm" onSubmit='<%= "event.preventDefault(); " + renderResponse.getNamespace() + "updateProduct();" %>'><aui:input name="redirect" type="hidden" value="<%= redirect %>" /><aui:input name="uuid" type="hidden" value="<%=product.getUuid()%>" /><liferay-ui:error exception="<%= Exception.class %>" message="exception testing..." /><aui:fieldset><aui:input name="name" label="Name:" value="<%=product.getName()%>" size="40"/><aui:input name="qty" label="Qty:" value="<%=product.getQty()%>" size="10"/><aui:input name="comment" label="Comment:" value="<%=product.getComment()%>" size="80"/> </aui:fieldset><aui:button-row><aui:button type="submit" /><aui:button onClick="<%= redirect %>" type="cancel" /></aui:button-row></aui:form><aui:script>function <portlet:namespace />updateProduct() {submitForm(document.<portlet:namespace />productForm);}</aui:script>16.Add ProductUpdate.javaFile path:/myliferay-ext/docroot/WEB-INF/ext-impl/src/com/accentrix/ecatalog/product/action/Product UpdateAction.javaimport javax.portlet.PortletConfig;import javax.portlet.PortletRequest;import javax.portlet.WindowState;import org.apache.struts.action.ActionForm;import org.apache.struts.action.ActionMapping;import com.accentrix.ecatalog.product.action.ProductSaveAction.Form;import com.accentrix.ecatalog.product.model.Product;import com.accentrix.ecatalog.product.model.impl.ProductImpl;import com.accentrix.ecatalog.product.service.ProductLocalServiceUtil;import com.liferay.portal.kernel.util.ParamUtil;import com.liferay.portal.struts.PortletAction;import com.liferay.portal.theme.ThemeDisplay;import com.liferay.portal.util.WebKeys;import com.liferay.portlet.ActionRequestImpl;import com.liferay.portlet.PortletURLImpl;/*** @author tom.wu**/public class ProductUpdateAction extends PortletAction {@Overridepublic void processAction(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {Form fm = (Form) form;Product product = new ProductImpl();product.setUuid(fm.getUuid());product.setName(fm.getName());product.setQty(fm.getQty());product.setComment(fm.getComment());ProductLocalServiceUtil.updateProduct(product);String url = this.getRedirctURL(portletConfig, actionRequest, fm.getUuid());super.sendRedirect(actionRequest, actionResponse, url);}protected String getRedirctURL(PortletConfig portletConfig, ActionRequest actionRequest, String uuid) throws Exception {String redirect = ParamUtil.getString(actionRequest, "redirect");ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);PortletURLImpl portletURL = new PortletURLImpl((ActionRequestImpl) actionRequest,17.Update struts-config-ext.xmlFile path: /myliferay-ext/docroot/WEB-INF/ext-web/docroot/WEB-INF/struts-config-ext.xml<?xml version="1.0"?><!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN""/struts/dtds/struts-config_1_2.dtd"><struts-config><form-beans><form-bean name="productForm" type="com.accentrix.ecatalog.product.action.ProductSaveAction$Form" /></form-beans><action-mappings><action path="/productportlet/demo" type="com.accentrix.ecatalog.product.action.ProductAction" scope="request" ><forward name="products" path="products" /><forward name="product.success" path="product.success" /><forward name="product.err" path="product.err" /></action><action path="/productportlet/add" type="com.accentrix.ecatalog.product.action.ProductAddAction" scope="request"><forward name="product.add" path="product.add" /></action><action path="/productportlet/save" type="com.accentrix.ecatalog.product.action.ProductSaveAction" scope="request" name="productForm"> <forward name="product.error" path="product.add" /></action><action path="/productportlet/edit" type="com.accentrix.ecatalog.product.action.ProductEditAction" scope="request" ><forward name="product.edit" path="product.edit" /></action><action path="/productportlet/update" type="com.accentrix.ecatalog.product.action.ProductUpdateAction" scope="request" name="productForm"/> </action-mappings></struts-config>18.Add ProductDeleteAction.javaFile path:/myliferay-ext/docroot/WEB-INF/ext-impl/src/com/accentrix/ecatalog/product/action/Product。

Liferay组织管理和权限设置

Liferay组织管理和权限设置

Liferay组织管理和权限设置Portal组织管理和权限设置Portal用户架构User:用户,最基本的单位,用户可以加入到多个其它对象中,如组织单元,社区。

Organization:组织单元,以地域或其它组织方式来组织的一系列容器,可以有层级关系,比如我们的项目中的china,gd 等等。

Community:社区,由一系列相同爱好或其它有共性的用户来组成,比如fishing。

Role:角色,角色用来组织权限的,一系列拥有同样权限的用户可以拥有同样的角色,角色有下在三种:○Portal Roles系统角色○Organization Roles组织角色○Community Roles社区角色User Groups:用户组,用户组可以拥有组织角色和社区角色,可以看成Organization和Community的组合体。

e天下门户的组织架构这里标数字的都是组织单元,表示其层级关系。

页面构建1.组织单元的创建:组织单元管理在EnterPriseAdmin这个Portlet中。

这里我分别创建了三个组织单元,按照上面的层级关系。

编辑页面如下:实验证明中文组织单元名称也是可行的。

2.为组织单位管理页面在组织单拉后面的actions菜单后面单击选择Manage Pages.修改中国这个站的友好网址添加页面,如下图,好的习惯就是为每个站点添加一个管理页,url为admin管理页guest用户不能看3.页面定制权限设定刚才创建的站点只有portal管理员才有权限管理,包括内容发布,页面定制等,下面的动作是如何创建内容发布员。

这里的内容发布员,只有增加,删除等权限,没有审批权限,他发布的内容要内容审批员审批后才可以让用户看到。

1.创建用户:创建用户同样是用Enterprise Admin这个portlet。

点击Add User,增加用户这里的Screen Name不能是中文。

2.把用户加入到组织单元。

3.点击中国这个组织单元后面的actions后菜单中选择Assign Members。

Liferay Portal5.2.3环境的初步搭建

Liferay Portal5.2.3环境的初步搭建

Liferay Portal5.2.3环境的初步搭建一、准备工作1、开发包目前Liferay官网/zh/home上只提供最新版本的liferay包下载,下载5.2.3版本需要到开源社区/projects/lportal/files/Liferay%20Portal/,选择5.2.3版本下载下面两个包:Portal源码包:liferay-portal-src-5.2.3.zipTomcat捆绑包:liferay-portal-tomcat-6.0-5.2.3.zip2、开发工具开发工具建议版本本文使用版本JDK 1.6以上 1.6.0_22Ant 1.7以上 1.8.2MyEclipse 5.5以上7.5Tomcat 6.0以上 6.0.18注意:这里的Tomcat是liferay-portal-tomcat捆绑包中的tomcat,所以不需要再另外下载;Ant到/bindownload.cgi下载最新的apache-ant-1.8.2.bin.zip3、目录结构本文假设操作目录结构如下:D:/workspace 根目录D:/workspace/ant ant的安装目录D:/workspace/Liferay liferay工作目录D:/workspace/Liferay/portal liferay-portal源代码目录D:/workspace/Liferay/service liferay-portal捆绑Tomcat的目录D:/workspace/Liferay/ext liferay-portal的扩展项目目录二、基础配置1、JDK的安装配置JDK的安装配置和以前一样,这里不再赘述,提醒一下安装配置完成别忘了使用“java -version”和“javac”来检查是否安装成功2、Ant的安装配置解压缩apache-ant-1.8.2.bin.zip到D:/workspace/ant目录下,在环境变量(Windows7下右键点击“计算机”后选择“高级系统设置—>高级—>环境变量”)中为Path系统变量新增如下路径:“D:/workspace/ant/apache-ant-1.8.2/bin;”,保存。

PORTAL V6安装

PORTAL V6安装

Portal V6.0 安装指南1Portal V6 介质包一览2安装步骤2.1 安装前的准备●最好是:windows2000/2003系统——虽然xp可以安装portal,但是无法安装db2。

●其次:正版windowsXP系统,装好补丁。

——有的xp老版本下面无法修改dns后缀!●安装好笔记本自带的驱动,安装好其他常用软件,ghost备份。

——portal很难有把握一次安装成功。

而熟练之后,直接在本机系统上安装,周期也不长。

如果每次都重新装xp系统、补丁、软件就太麻烦了!●配置好本机的ip,插上网线!——was服务器,是提供网络服务的!●退出杀毒软件。

——否则会频频报错。

万一拒绝了一个,整个过程彻底完蛋。

●修改机器名和dns后缀:✓我的电脑〉属性〉计算机名>更改〉计算机名(tigerdh)✓我的电脑〉属性〉计算机名〉更改〉其他〉主DNS后缀()✓重起计算机后更改生效。

●安装jre此时使用portal,会出现“WCM applet无法装入”的错误提示。

✓在portal安装之前,如果已经单独安装jdk,jre,就不会出现这种情况。

✓出错提示后,点击浏览器上方的突出的一行安装提示,安装之后,再选“总是有效”就可以了!2.2 安装过程运行W-SETUP目录中的install.bat,按以下步骤执行初学者可以点击“启动信息中心”按钮获取帮助。

不需要点击,直接next。

接受许可证协议选择标准安装(就装这个)或客户化安装指定WebSphere Application Server(WAS)的安转路径。

装在c盘,或其他分区都可以。

但后面的名称不宜修改,因为还有portal、RAD、PortalUpdateInstaller等系列软件,用这个文件夹体系,使用说明时更方便。

指定节点名和主机名(主机名一定要写全称;要给机器名设置dns)前面主机设好了,此处自动获取。

Cellname:tigerdhNodename:tigerdh ——虽然我已经修改为tigerdh,但是这里的单元名、节点名都是tiger。

Liferay Portal CE6.1 GA安装手册(Oracle版)

Liferay Portal CE6.1 GA安装手册(Oracle版)

Liferay Portal CE6.1 GA安装手册介绍:liferay是一个现成的,即开即用的,功能完备的门户网站Liferay Portal,是一个完美的桌面协同办公组合,完全为企业和机构设计,并且可以随意适应不同的应用Liferay Social Office. 提供60余种工具和一系列当今最赋创新意识的技术,可以创建Web站点、内部网,以此来向适当的客户群显示符合他们的文档和应用程序环境:winXP sp3, liferay ce6.1(tomcat7.0),jdk6.22,oracle10g 10.2.0.4 默认安装路径为D:\Liferay,且已安装好jdk及oracle数据库安装:1.下载liferay-portal-tomcat-6.1.0-ce-ga1-20120106155615760.zip2.将zip文件解压到D:\Liferay下3.修改D:\Liferay\tomcat-7.0.23\bin下的catalina.bat,如下:4.修改D:\Liferay\tomcat-7.0.23\bin下的setenv.bat,如下:以上修改是为了防止启动tomcat后的命令窗口不闲乱码,以及修改所在时区5.修改D:\Liferay\tomcat-7.0.23\conf\Catalina\localhost下的ROOT.xml,如下:6.由于使用的是oracle数据库,所以必须使用的ojdbc14.jar驱动。

将ojdbc14.jar放入D:\Liferay\tomcat-7.0.23\lib下,ojdbc14.jar可以再oracle 官网下载7.在D:\Liferay\tomcat-7.0.23\webapps\ROOT\WEB-INF\classes下新建文件portal-ext.properties,内容如下:由于使用的是oracle10g版本的数据库,所以必须加上红线所划的部分,以注明数据库连接方式8.在命令窗口模式下使用catalina.bat run的方式启动tomcat,启动成功后在浏览器上输入http://localhost:8080访问liferay并做相应配置,至此liferay安装启动完成。

liferay portal

liferay portal

Liferay研究(一):初步在新Tomcat下部署从现在开始,会把我最近在研究的开源Portal Liferay一些心得贴出来。

研究Liferay版本:Liferay Professional 4.0.0柯自聪兄弟写过一系列的Liferay Portal开发文章,参考/ea moi/。

所以基础性内容,本文不再细说,可参考柯自聪的文章或Blog。

(一)部署Liferay PortletLiferay简单部署一个portlet并不是很复杂,通过WEB-INF目录下的portlet.xm l、liferay-portlet.xml、liferay-display.xml描述即可。

描述portlet.xml portlet.xml用来定义Portlet的诸如部署名称、初始化参数、支持模式、re source bundle等普通的初始化信息,包括:portlet-name、display-name、portlet-class、init-param、expiration-cathe、supports、portlet-info、security-role-ref 等等。

其正式的规范请参考:/xml/ns/Portlet/Portlet-app_1_0. xsdliferay-portlet.xml 定义Portlet默认可用的用户组、默认模板、是否支持多个实例等,规范由/dtd/liferay-Portlet-app_3_5_0.dtdliferay-display.xml 定义Portlet默认的所属类别。

Liferay Portal对Portlet实行按类别管理和划分用户权限。

Liferay是基于Struts Template页面模版技术来实现页面的,所以Liferay默认提供了com.liferay.portlet.StrutsPortlet这个Portlet Class来完成Portlet处理的;当然为了简单对普通jsp页面的处理,Liferay也提供了com.liferay.portlet.JSPPortlet等其他Portlet Class。

Liferay 使用手册

Liferay 使用手册

Liferay 使用手册
刘建军
os9@
1.快速入门
1.1. 安装
去liferay官方网站上下载liferay-portal-tomcat-4.2.2.zip,直接解压就可以,然后执行liferay-portal-tomcat-4.2.2\bin\startup.bat命令,显示liferay已经启动
1.2. 测试
在浏览器上输入:http://localhost:8080/
1.3. 登录
用户名:test@ 密码:
test
登录后界面如下:
1.4. 添加portlet
然后在左边出现如下画面,就可以选择自己想要的portlet 了。

从这里进入 添加portlet
2.高级使用
2.1. 增加新用户
从这里进入
保存就完成添加
用户建立后,在这里改密码在这里可以将用户添加到组织或区域中
喜欢中文?
这里改改就行
2.2. 给用户增加角色
第一步:进入角色标签页
先选中角色,
再点击分配第二步:找到要添加到adminstrator角色的用户
2.3. 增加组织
与添加用户类似2.4. 增加地域
与添加用户类似先点击可用的再更新关联关系
2.5. 变更主题
从这里进入
选你所爱。

WAS+7.0+安装部署+Liferay+6.0.6

WAS+7.0+安装部署+Liferay+6.0.6

W AS 7.0 安装部署Liferay 6.0.6准备工作:*** 安装WAS 7.0以及安装好应用程序服务;*** 下载适合Websphere的liferay安装包:liferay-portal-6.0.6-20110225.war,具体可从/projects/lportal/files/Liferay%20Portal/ 上下载;*** 下载liferay的依赖包:liferay-portal-dependencies-6.0.6.zip(注意版本一致),具体可从/projects/lportal/files/Liferay%20Portal/ 上下载;然后解压其中的三个jar包(hsql.jar portal-service.jar portlet.jar) 到WAS的扩展库“%your location%IBM\WebSphere\AppServer\lib\ext”中;*** 下载合适的JDBC的jar包放置在WAS的扩展库“%your location%IBM\WebSphere\AppServer\lib\ext”中,我的环境是DB2,应用的jar包为db2jcc.jar db2jcc_license_cisuz.jar db2jcc_license_cu.jar db2jcc4_licensed.jar(可以在配置WAS的JDBC提供程序时找到)。

*** 在%your location%\IBM目录下,新建文件夹liferay\Liferay Home\,创建配置文件portal-ext.properties,并添加关于数据库连接池和邮件会话的相关信息(我是直接利用WAS 提供的连接池和邮件会话,如果自己配置,具体参见的帮助文档):=jdbc/LiferayPool=mail/MailSessionOK,准备工作到此为止。

接下来,启动WAS服务,可以依次选择“开始- 所有程序- IBM Websphere - Application Server Network Deployment v7.0 - 概要文件- AppSrv01 - 第一步” ,然后启动服务器;通过“管理控制台”打开WAS集成解决方案控制台,然后进行必须的配置。

Liferay 6开发指南

Liferay 6开发指南

Liferay 6.0开发指南1. 介绍1、已有的应用集成方法:将应用重写为一个Portlet创建一个简单的Portlet整合应用(一般使用Web Service),可以使用iframe或http 代理(可以使用Liferay's WebProxy portlet)。

已有的应用要像部署门户插件一样,把WAR文件部署到应用服务器里,可以使用控制面板或直接复制的方式完成。

Liferay可以自动创建一个Portlet通过iframe集成已有应用。

2、自定义主题风格(Themes)3、自定义布局模板(Layout Templates)4、自定义或扩展门户功能:Hook plugins)Hook plugins可以用来扩展Liferay的核心功能。

5、高级扩展方式:Ext plugins扩展插件可以允许开发人员修改Liferay的核心部分,可以修改任何一个类。

扩展插件部署之后需要重新启动应用服务器。

Liferay 6.0之后用Ext plugins的开发方式替换了原来的Ext Environment开发方式,这样可以简化部署。

之前的扩展环境可以转换为一个独立的插件。

2. 插件开发工具包(THE PLUGINS SDK)2.1 安装Liferay1、下载Liferay Portal bundled with Tomcat;/downloads2、下载Plugins SDK;3、删除liferay-portal-[version]/tomcat-[tomcatversion]/webapps 除ROOT和tunnel-web目录的其他所有文件夹。

4、打开liferayportal-[version]/tomcat-[tomcat-version]/bin目录,运行startup.bat,启动Liferay。

5、http://localhost:8080,默认帐号/密码:test@/test。

6、设置环境变量ANT_HOME,将$ANT_HOME/bin加入到PATH环境变量中。

6.LifeRay Portal 6学习笔记7Liferay的一些常见问题

6.LifeRay Portal 6学习笔记7Liferay的一些常见问题
LifeRay Portal 6 学习笔记 7:Liferay 的一些常 见问题
1、如何删除绑定的 tomcat 里面的示例数据库
Liferay 从 5.2 开始在下载的 Liferay 里面有一个 7cogs 的示例数据库,如何删除这个示例程序呢?
a、在 tomcat/webapps 下面找到目录 sevencogs-hook 这个目录,删除掉 b、在删除与 tomcat 平级的 data/hsql 目录 c、重启 tomcat,这时的管理员帐号就变为 test@/test
5、如何得到 Liferay 的最新源码
liferay 的 SVN 库地址如下:/repos/public/ 可以从这里获取到关于 feray 的最新源码 用户名/密码:guest/guest
如 portal 的最新源码的地址如下:/repos/public/portal/trunk
2、更改数据库连接
Liferay 在默认状态下是使用的一 HSQL 这个示例数据库,Liferay 从在 4.x 及以前的数据库连接配置是保存在 tomcat/conf/Catalina/root.xml 文件里面,现在在这个目录下面还可以看到这个 root.xml,但是从 5.x 开始,Liferay 的配置信息 都移动了 portal.properties 文件里面。
3、国际化信息
Liferay 的国际化信息文件是存在 Language.properties 里面的,如果我们对 Liferay 里面的中文翻译不满意可以修改 Language_zh_CN.properties 里面的内容,同样 Liferay 不建议直接修改这个文件。
在 Ext 环境中的 ext-impl/src 下面建立目录 content,在其下建立 Language-ext_zh_CN.properties 和 Language-ext_zh_CN.properties.native,后一个文件实际没有用,是方便我们以后查看的,properties 里面只能存储 ascii 的, 所以我们在后一个文件里面写上相应的中文,方便以后查看。

lifeRay开发环境搭建

lifeRay开发环境搭建

环境:操作系统:win7 x64IDE:eclipse 3.7.2Liferay版本:lifeRay6.0.6服务器:jboss 5.1需要以下文件:第一步:安装liferay IDE在eclipse的导航选项中选择help>Install new software后显示以下窗口填写下载文件的路径,开始安装。

*第二步:配置环境变量JBOSS_HOME解压填写环境变量第三步:配置SDK解压在eclipse的导航选项中选择windows>perfenences 后显示以下窗口选择add 出现以下窗口修改SDK指向服务器:在SDK根目录下新建build.admin.properties文件(admin为你的的计算机用户名)。

输入以下内容app.server.type=jbossapp.server.dir=D:/MyWork/liferay-portal-jboss/jboss-5.1.0app.server.deploy.dir=${app.server.dir}/server/default/deployapp.server.lib.global.dir=${app.server.dir}/server/default/lib/extapp.server.portal.dir=${app.server.dir}/server/default/deploy/ROOT.wardir为解压文件下的jboss-5.1.0的文件夹路径第四步新建服务器解压在eclipse的导航选项中选择windows>perfenences 后显示以下窗口点击Add选择以下服务器填写解压文件路径,选择对应jre第五步新建porlet在弹出窗口中填写Project name,选择对应SDK和刚才新建的Runtime服务器。

点击Finish 注意:弹出的窗口是询问你是否修改配置文件选择NO第六步:发布portlet安装ant解压到任意文件夹;设置环境变量启动jboss5.1.0就是运行run.bat启动后在eclipse中右键选择刚才新建的portlet目录下的build.xml。

liferay portal-安装指南

liferay portal-安装指南

liferay porta安装指南(初稿)本文档中有很多删减的和翻译理解上面的错误,请大家及时向中文Liferay 反映,以便我们能更加完善这些文档.谢谢!liferay porta安装指南(初稿) (1)1 介绍 (2)1.1 入门 (2)1.2 推荐配置 (2)2 安装 (2)2.1 配置开发环境 (2)2.2 获得liferay portal 源码 (3)2.3 安装你的IDE--Eclipse (3)2.4 用liferay的源码做开发 (3)2.4.1 获得Orion容器 (4)2.4.2 在Eclipse中配置Orion (4)2.4.3 启动Orion (5)2.4.4 配置你的Properties (6)2.4.5 配置Orion (6)2.5 创建扩展环境 (7)2.5.1 启动扩展 (7)2.5.2 添加插件(主要是编译专业版) (8)2.5.3 挂载数据库 (8)2.5.4 starting Liferay (8)3 关于翻译 (8)1介绍1.1 入门牋□ 在这个文档中,我的目标是帮助大家设置你的额开发环境,使你可以自己在这个软件上开发出portlets.这个文档的起点是你必须具备一些web常识以及做Servlet,jsp的开发经验.你们可能会在不同的操作系统上运行.我的能力有限,但是我会尽量保证这个配置可以适用于不同的系统1.2 推荐配置牋 虽然你的配置可能不高,但是作为开发和定制化Liferay,我们推荐下列硬件配置:1G内存2.0 G CPU2安装2.1 配置开发环境配置Liferay可以完成任何企业级的JAVA应用任务.Liferay控制使用几个框架. 幸运的是,大部分的框架Liferay已经把它捆绑在了一起. 如果你想在Liferay上安装一些其他的工具.首先你要确保你的机器上已经正确安装java JDK.你最好在你的机器上安装最新稳定的J2SE1.4.2这个版本.如果你没有请到这里去下载最新的版本.假设我下载以后解压缩放在D:\Java 这个目录中!当然你也可安装在你喜欢的目录中,但是从现在开始下文提到的{Java}我们都指的是这个安装目录.虽然你喜欢使用Sun的默认java编译器,但是我们推荐你使用IBM的Jikes编译器--通常它可以描述更多的编译错误.确定你下载的是Jikes的1.21的版本,因为1.22是在JDK1.5下工作运行的,由于不能向后兼容所以Liferay portal 不能用.最终你还需要从.下载Ant这个Java基本编译工具,解压缩到上面我们提到的那个目录(D:\Java).接着设置你的环境变量:在WIndows下,打开控制面板/系统/高级/环境变量,新建变量:JAVA_HOME,ANT_HOME,JIKES_HOME注意要把他们的路径写正确.设置JAVA的CLASSPATH以便其他的应用能在机器上运行.在PATH 中添上%ANT_HOME%\bin;%JAVA_HOME%\bin;%JIKES_HOME%\bin2.2 获得liferay portal 源码现在开始,从 /web/guest/downloads/portal_source下载最新稳定的Liferay portal企业版代码. 我把它解压缩到这个目录 D:\cvsroot\liferay (我使用CVS来储存代码),接下来我们将使用{Liferay}来代表这个目录. 当你下载了这个稳定的Liferay,Then download the latest stable Liferay,这个指南已经包括了基于tomcat的专业版.我将在稍后在这章介绍关于Tomcat的捆绑.2.3 安装你的IDE--Eclipse尽管你可能用记事本修改或者部署Liferay portal 一些简单的事情,但是一个好的IDE 工具可以加速提升你的工作.我向你展示 Eclipse这个工具,它可以很方便的部署和运行Liferay portal.下载最新的Eclipse版本/downloads/index.php. 安装 Eclipse 到 {Java}\eclipse 且运行它.在菜单上 选择File/ Switch Workspace…然后选择 {Liferay}这个目录.在workspace中启动你的工程, 选择 File /New/Project. 在对话框中选择Java Project 然后点击Next.在这个新的窗口中输入portal作为Project Name然后点击Finish.如果你恰当设置Workspace, 你应该可以在导航中看到portal这个工程的透视图. 在这个工程的根目录上单击鼠标右键选择Properties/Java Build Path 点击右边Libraries 你需要的jar包都已经加载上了.这些jar文件是通过{Liferay}\portal 下面的 .classpath 文件定义加载的.添加Eclipse的插件是很容易的事情. 自从 Eclipse集成Ant以后,启动Ant是个很容易的事情在Window菜单下选择Show View/Ant. 你就可以看到这个Ant显示在你的透视图中.增加 Liferay’s 构建文件也是这样的简单.简单到你就选择透视图上面的Ant然后单击Ant +这个符号. 注意这样会用Ant读到出现每个目录中自己的build.xml文件. 我们单击选择portal这个目录中的build.xml文件. 你的启动图形如图 2.3.2.4 用liferay的源码做开发在一下部分我们主要介绍怎么使用Orion这个容器对Liferay的源码做开发和调试. It is important to note that working off the core source is notrecommended.如果你想要扩充Liferay portal的功能的话,它是你要增加一个扩充的环境(在2.5节我们主要讲怎么扩展功能).Development of the core portal should onlybe done for bug fixes orenhancements that potentially would make it into the next build. Typical developers willnot need to read this section.2.4.1获得Orion容器首先从 , 下载Orion. 把这个文件释放到(i.e. {Java}\orion-2.0.6)这个目录,以下我将使用{orion}来代表上面这个路径.运行这个命令来测试你的服务“java –jar orion.jar”.2.4.2在Eclipse中配置Orion在Eclipse中启动运行Orion需要我们稍微花些时间设置一下.首先在你的透视图下,右键工程名称在出来的菜单中选择Debug as/Debug,然后会出来一个对话框.如果你以前在 Java Application下面已经配置好一些,你可以新建一个或者删除它.在前面点击New这个按钮, 并且改变下列内容:Main Tab页:1. 改变name配置为 “orion”2. 设置 Main class 为 “com.evermind.server.ApplicationServer”Arguments Tab页:1. Program arguments: -config {orion}/config/server.xml - userThreads (note thatyou need to change the directory path)2. VM arguments: -Xmx256m - Dfile.encoding=UTF8 - Duser.timezone=GMTClasspath Tab页:1. under the User Entries group, remove the “portal (default classpath)” entry2. 单击 Add External JARs,在系统中找到你安装orion的目录中的orion.jar 添加它注意: make sure that within your JRE Tab, your ProjectJRE points to a SDK asopposed to just a JRE (i.e. my Project JRE hasj2sdk1.4.2_05 next to it in parenthesis.This may require you to add another entry within Java(from the left navigation) --Installed JREs.2.4.3启动Orion配置Orion有三个关键的文件. 第一个, {orion}\config\server.xml,let’s you specify which “web-sites” will be accessible when started up. 增加一个新的website 并插入这些内容:<web-site path="./web-sites/- web.xml" />你还的指定一个Orion的另一个编译器:<compiler executable="jikes" classpath="{Java}\jre\lib\rt.jar" />现在你已经详细指定了这个新的website,你需要创建一个调用文件-web.xml 在这个目录中{orion}\config\web-sites\. 你可以看到类型于(Figure x.2. -web.xml)的图.最后, 在{orion}\config\application.xml, 你需要增加两个模块web- module 和ejb-module.所有web-app的元素声明在你的 web.xml但是这些声明也必须定义在你的 application.xml:见图(Figure x.3. application.xml)通过插入ejb-module元素给你的EJBs增加一个适当的参考. 注意你可以在Orion中通过使用"file:"前缀直接找文件. An advantageof using this prefix is that you don’t have to deploy your files to the server. 这个可以有助于你快速的调试JSPs (简单的保存和更新你的JSP).另一个原因是它可以很好的编译和部署source文件成为class.Note: When using the “file:” prefix for the portal-ejbmodule, you need to ensure thatthe portal-ejb.jar does not exist within your{orion}\applications\ directory.最后,你必须编辑 {orion}\config\data- sources.xml 是你的应用能访问到你的数据库. 如果你使用的mysql请确认mysql.jar已经部署到 {orion}\lib\目录, 配置你data- sources.xml 文件例似下面:<data-sources><data-sourceclass="com.evermind.sql.DriverManagerDataSource"name="Liferay"location="jdbc/LiferayCore"pooled-location="jdbc/LiferayPool"xa-location="jdbc/xa/LiferayXA"ejb-location="jdbc/LiferayEJB"connection-driver="com.mysql.jdbc.Driver"url="jdbc:mysql://localhost/lportal"username="root"password=""inactivity-timeout="30"schema="database-schemas/mysql.xml"/></data-sources>2.4.4配置你的PropertiesLiferay的配置多数都在 portal.properties 这个文件中. 类似于你的这个文件 build.properties,你在portal- ext.properties设置它的属性都比在portal.properties它本身根方便.给你的portal配置一个,创建一个新的文件在{Liferay}\portal\util-java\ 这个目录中文件名为portal- ext.properties. 在里面添加下列设置:portal.ctx=/portal此外,注意在这个portal- ext.properties设置这个属性就不用考虑在portal.properties设置.2.4.5配置Orion如果你想要你的Ant命令知道在什么地方部署它,你需要创建一个扩展名类app.server.{username}.properties. 在这个文件中添加一行 app.server={orion}这个{orion} 就是我们安装Orion的目录, 例如这样(i.e. app.server=D:/Java/orion- 2.0.5). 最后用你Eclipse的Ant 显示, 运行你portal 目录中的start和delpoy 标记. 如果你使用"file"前缀,不要忘记去删出portal-ejb.jar 以后部署!你全部设置了! 在你的Debug透视图中到前面单击bug 这个图标,这时在你的控制台就会看到Orion开始启动.2.5 创建扩展环境通过扩展环境来开发和部署你的portlets 是你最感兴趣的. 这样可以改良你的portal 但是不会让你有任何头痛的. 任何时间发布一个新的稳定的Liferay portal 的版本,是你做的并且是一个震惊的,你可以把它卖掉.同样可是说你开发一个健壮的扩展环境. 所有新的classes,JSPs,和所有的新的改变都应该在{Liferay}\ext里面.It is in your best interest to develop your portlets via an Extension Environment. Thiswould allow you to upgrade your portal without any headaches. Any time a new stableversion of Liferay Portal is released, all you would need to do is drop in the new jarsand you’re set to go. With that said, your development should only be done within theExtension Environment as well. Meaning, all new classes, JSPs, and all changes ingeneral, should be within {Liferay}\ext.2.5.1启动扩展设置启动你的扩展环境是很简单的. 在做任何事情之前,你需要改变一个属性文件(.properties)在 {Liferay}\portal目录中. 注意在这个.properties 默认的文件中你从未改变这个值. 在每个.properties文档的顶部遵循它的注释替换(改变),需要创建一个扩展名类似于这个release.{username}.properties的文件. 你可以在开始/运行 下打开一个命令提示这个${username}的值会出现在Documents and Settings 后面.在你的这个新的.properties文件中添加正确的一行({Liferay}是真实的目录:lp.ext.dir={Liferay}/ext(Note that it’s a forward slash)接下来, 在 2.3节中描述的Ant显示中,你能够扩展portal build.xml中的对象(taegets)列表. 在这些对象(taegets)中,你可以看到 clean, start, build- ext.向前双击那些对象(taegets)一会儿观察它的输出. 你将看到一大堆文本的输出通过指示说明你的扩张环境在运行.请仔细检查控制台输出的红色错误. 你可能发现你有一些可怕的错误设置在你的属性中. 如果所有的都很好,那么你应该能到这里浏览你你扩展目录{Liferay}\ext!2.5.2添加插件(主要是编译专业版)主要是添加一个Tomcat编译环境老启动Liferay的专业版.大家看文档吧,确实累了2.5.3挂载数据库对于这样挂载数据库请大家参考这个,/web/guest/documentation/development/databases2.5.4starting Liferay现在你有一个完整的开发环境,到前面单击Tomcat这个图标来启动你的web 服务.此时在你的portal已经启动,你可以在浏览器中输入 http://localhost 来查看运行效果!3关于翻译 蚊子 MSN:wenbin151@ 欢迎大家关注中文Liferay .因为本人水平有限(实际还没有通过英语四级),一些文字描述是根据我的理解写的.也有我同事(flora:flora@)的帮助.我代表中文Liferay谢谢我的partner:flora(MM).呵呵.Good luck!牋 2005-08-31。

Liferay Portal 6.1基本功能介绍v1

Liferay Portal 6.1基本功能介绍v1

Liferay Portal 6.1基本功能介绍火云计算工作组邓秋生Liferay Portal既是一个开源门户网站建设工具,同时也是一个基于Java架构的应用软件系统开发平台。

它不仅具有强大的网站内容管理和基于文件的内容管理功能,而且还集成了协作套件、开放社交、应用开发、权限管理、工作流、知识库、规则引擎和搜索引擎等J 2EE应用程序。

Liferay Portal是一个完全可定制的互联网应用系统建设平台,并且其社区版是完全免费的,值得各类门户网站建设人员和Java应用开发人员重点关注。

一、什么铸就了Liferay的卓绝Liferay Portal是一个包含大多数普通应用程序的Web体验平台,这些应用程序可以作为搭建站点的组装模块。

由于Liferay包含的功能十分丰富,因此,使用Liferay将彻底改变着手搭建站点的方法。

事实上,要看需要搭建什么样的站点,搭建普通站点可能完全不需要编写任何代码。

如果开发人员已经有一个大型应用系统成竹在胸,那么,Liferay可以为他提供一个极佳的Web应用开发平台,该平台可以更好地发挥开发人员的优势,及早发布应用系统。

这是为什么呢?因为开发人员不用编写代码就可以直接使用Liferay Portal提供的用户管理、安全性、标准支持和通用功能,所以,可以集中精力开发自己的应用。

当然,还有许多上面没有提及的功能,比如:用户可以利用Liferay社交功能在网络中相互联系、相互协作和创建内容等。

事实上,要花费整本书的篇幅才能完整地描述Liferay 能做什么,但是,我们尽最大努力用本章后半部分对Liferay做一个概述。

总而言之,Liferay Portal不仅仅是一个开发平台、内容管理系统、社交网络和协作工具,它是建设网站的最佳途径。

二、Liferay Portal内容管理系统内容管理系统是Liferay Portal最常用的组成部分。

实际上,许多人使用Liferay Portal,就是为了实现内容管理而已。

LiferayPortal应用之安装

LiferayPortal应用之安装

LiferayPortal应用之安装Liferay是当今较为成熟的开源企业级Portal软件产品。

Liferay以纯Java开发,采用了最新的Java技术和架构,提供了功能较强的内容管理器与JSR-168 Portlet容器的有机集成,内嵌了丰富的协同工作组件(Portlets),提供基于CAS和JAAS的单点登录,支持20多种语言,较为完整的技术文档等等,不愧是一款优秀的开源软件。

由于采用了良好的技术架构,在优秀的Java应用服务器的支持下,Liferay能够提供较大型的企业级应用。

使用者还可以对Liferay源码进行修改,通过二次开发添加新的功能,来满足实际生产的需要。

本人将陆续对Liferay Portal在Windows环境下的应用和开发过程进行简略介绍,具体分篇为“Liferay Portal应用之安装”,“Liferay Portal应用之配置”,“Liferay Portal应用之开发”和“Liferay Portal应用之实例”。

本文是“Liferay Portal应用之安装”篇。

一、安装运行环境软件Liferay的运行环境要求JDK 1.5以上的版本。

为了兼容后来的Liferay新版本,建议使用最新的Java版本。

在Java之家网站,我们选择最新的JDK 6(即1.6版本),下载Windows下的JDK 6安装文件jdk-6u7-windows-i586-p.exe。

如果在Windows系统中已经安装了其他版本的Java,你可以继续保留旧版本,也可以先卸载旧版本再安装新版本。

新旧版本共存时,需要配置Windows系统的环境参数来选择实际使用的那个版本。

为了保持系统运行和开发环境的整洁,便于配置管理,建议把Java相关的软件全部安装到C:\Java\目录中,而不是缺省的C:\Program Files\下。

因此,在安装时需要指定JDK 6的安装目录是C:\Java\jdk-1.6\,JRE 6是在C:\Java\jre-1.6\。

Liferay Portal 6学习之路-学习笔记完整版

Liferay Portal 6学习之路-学习笔记完整版

③、
Portlet 有一些附加的功能是 Servlet 所没有的
Portlet 能够存取及储存永久配置文件及定制资料。 Portlet 可以存取使用者数据 Portlet 具有 URL 的重写功能在文件中去动态建立连结, 允许 portal server 不用去知道如何在网页的片 段之中建立连结及动 作。 Portlet 可以储存临时性的数据在 Portlet session 之中,拥有两个不同的范围 :application-wide scope 及 Portlet private scope 。 ④、 Portlet 不具有一些功能, 但是 Servlet 却有提供
WSRP
wsrp 是 OASIS Web Service For Remote Rortlet 的缩写。WSRP 是 Web Service 的一种新的商业应用,一种新的标准, 主要用来简化 portal 对于各种资源或程序整合的复杂度,可以避免编程带来的整合麻烦和问题。而且 Portal 管理员可以从海量 的 WSRP 服务中选择需要的功能用以整合到目前所有的 Portal 中。它有三种角色:
Portlet 也是 Java 技术的 web 组件 Portlet 也是有特定的 container 在管理 Portlet 可以动态产生各种内容 Portlet 的生命周期由 container 所管理 Portlet 和客户端的互动是通过 request/response 的机制
单点登录: Portal 通常采用 ACL、 SSL、 LDAP 等业界标准的安全技术, 提供对所有现有应用系统的安全集成, 只需在 Portal 的 唯一入口上登录一次,就可以访问所有应用系统和数据。对于安全性要求较高的应用系统,如电子商务平台、交易系统等,通 过扩展接口传递用户身份信息,如数字证书信息、数字签名信息等,进行二次身份认证,保证单点登陆的安全性。

Liferay6实例教程

Liferay6实例教程

Liferay6Development DocumentationTABLE OF CONTENTS1.PREFACE ............................................................................................ 错误!未定义书签。

W HAT'S COVERED.................................................................................... 错误!未定义书签。

P REREQUISITE SOFTWARE ......................................................................... 错误!未定义书签。

A SSUMPTION........................................................................................... 错误!未定义书签。

2.LIFERAY INSTALLATION AND CONFIGURATION ......................... 错误!未定义书签。

D OWNLOAD ............................................................................................ 错误!未定义书签。

JDK I NSTALLATION................................................................................ 错误!未定义书签。

M Y SQL I NSTALLATION............................................................................. 错误!未定义书签。

liferay6.0 plug-in 安装说明

liferay6.0  plug-in 安装说明

A.安装plug-in 插件根据liferay官方的说明,plug-in插件要在如下版本的eclipse中才能安装Eclipse Helios (3.6.0) IDE for Java EE Developers下载地址是/downloads/download.php?file=/technology/epp/downloads/release/helios/R/eclipse-jee-helios-win32.zip 1.首先要在eclipse中Help > Install New Software...进入安装插件的页面,然后点击add按钮。

出现add repository 页面Name 栏中填Liferay IDEurl 栏中填:/tools/ide/eclipse/helios/stable/然后点击ok。

2.在install页面中过一会就会出现liferay tooling 和liferay IDE ,都选中,然后点击next。

然后在下一个页面中点击finish就开始进行安装了,在安装的过程中会出现一个警告,大体内容是本软件包含有未签名的内容,其合法性和真实性没有保证,请问是否继续。

这个不用管,直接点ok就可以继续下去,安装完成后,会有提示框,问是否要重启,选中重启,plug-in IDE 就安装完成了。

如果安装的成功的话会看到如下2个图标。

B.安装sdk1.先下载sdk到本地,进入官方网站下载页面。

/products/liferay-portal/download/ce-vs-ee然后选择plugins sdk进行下载。

2.在eclipes中选择windows -> preferences ->Liferay3.然后在perferenceds页面中选择liferay IDE ,然后点击Install SDKs ,选择add 按钮,然后在new liferay SDK 页面中点击browser按钮,然后选择liferay sdk所在的目录。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Liferay Portal 6学习笔记:Liferay Portal6安装及简单设置博客分类:
Liferay
portalliferay企业应用
准备
首先到
/projects/lportal/files/Liferay%20Portal/6.0.3下载
liferay-plugins-sdk-6.0.3.zip
liferay-portal-sql-6.0.3.zip
liferay-portal-src-6.0.3.zip
liferay-portal-tomcat-6.0.3.zip
安装Portal 6
首先来安装一下Portal,先来第一眼看一下LifeRay是什么样子的。

1、解压liferay-portal-tomcat-6.0.3.zip
这个文件是Liferay绑定到tomcat下的一个版本,可以直接拿来用的(此版本带有一个HSQL数据库,所以不用连接数据库,如如连接其他数据库会在后面讲到),解压之后进入到liferay-portal-6.0.3\tomcat-6.0.26\bin目录,点击startup.bat运行tomcat,待tomcat运行后在浏览器中输入
http://localhost:8080即可进入看到liferay 6。

2、登录liferay Portal
在打开的浏览器中,点击右上角的login,输入帐号和密码。

在这里的输入的帐号密码为
email:bruno@
password:bruno
liferay从5.2之后的版本中都带有一个7cogs.inc公司的示例数据库,所以这里的管理员帐号密码如上。

如果删除示例数据库,则账号密码如下:
email:test@
password:test
3、设置语言
登录之后会发现,这里的Liferay是英文的,虽然这些英文也比较简单,但还是中文看着舒服。

点击左上角的Manager-control Panel进入到Liferay的控制面板。

我们首先设置当前用户的语言,点击左边最上面的My Account,然后在右
边的Miscellaneous下面找到 Display Settings,点击他。

然后在中间的Language中选择“中文(中国)”,在下面的Time Zone里面选择到“(UTC+08:00 ) China Standard Time“,点击右边的save,现在的界面就变成中文的了,看着亲切多了。

现在的只是修改了当前用户的显示设置,在左边的门户下面找到设置,和上面的个人类似位置,显示设置里面修改语言、时区以及相应的Logo、主题包等。

4、添加Portlet
Liferay的强大之一就是自由的配置添加Portlet,在这里我们刚才是在控制面板里面,现在点击左上角的”返回7Cogs,INC“或者是右上角的"去
-->7Cogs,Inc 私有的"(这里说明一下,私有的就是指这个组织的用户登录后可以看到的,公开的就是所有人都可以看到的)。

在这里点击右上角的”添加“),”更多“,这里可以看到如下图所示,这里面的这些内容管理、Google什么的都是Liferay里面自带的一些Portlet,可以在
这里将这些Portle添加到自己想要添加的位置,点击其中的添加或者直接拖到界面中即可。

我们将来自己开的Portlet也将在这里归类,并通过此方法添加进来。

如果要删除相应的Portlet,点击每个portlet上面的x,就可删除。

点击设置可以设置权限等。

5、页面配置
上面的是添加portlet,下面介绍一些其他的页面配置,点击左上方”管理“-->”页面“,这里可以看到如下图所示:
左边的home/documents等就是上面的导航,在这里可以为这些导航添加相应的图标,易记的URL,复制其他页面等,还可以为其添加下级页面,图中的下级页面,其实就是home/document等的二级菜单,其他的也很容易一看就明白,不再多说。

在外观风格处可以为其设置相应的风格和添加自定义CSS等。

6、设计布局
管理下面有一个”设计布局“,在这里可以对portle的布局做设置,这个也不必多说,相信大部分人都玩QQ空间,这个就是和QQ空间的布局是一样的。

现在的用的只是系统一些自带的布局,如何设计制作自己的布局,在后续中将提到。

7、其他设置
Liferay的大部分设置都可以在控制面板中看到,大部分设置还是比较简单的,多点两下差不多就熟悉了。

其他的一些设置就根据自己的需要和具体需求设置了。

Liferay的通过这样的配置可以实现很大程度上的自由和和可配置,对于需求不确定或者经常变更的还是很有用的,个人感觉比较适合产品化项目。

开发一定量的Portlet,根据用户的需要来通过配置实现相应的功能点。

PS:本来这一章想写开发环境的搭建和Liferay IDE的安装的,移到下一篇中,下一篇写Liferay IDE的安装,并开发一个自己的Portlet.。

相关文档
最新文档