官网上的教材说实话实在精简不清晰.

https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/creating-an-mvc-portlet

版本7的Action机制换了:

https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/mvc-action-command

上边的例子有不少java代码直接写在jsp里,感觉有点不舒服,要想想替代方法。

关于新建Portlet就不再赘述,只写过程。只需要简单几步,开发前先需要熟悉Gradle.

1、新建工程 File → New → Liferay Module Project.

如果建立了Liferay Workspace,就在Workspace上建立新Module工程

2、首先修改settings.gradle仓库地址:

目的是不再使用IDE建立的不可用仓库地址,红色部分删除

buildscript {
dependencies {
classpath group: "com.liferay", name: "com.liferay.gradle.plugins.workspace", version: "1.0.40"
}

repositories {
maven {
url "https://repo1.maven.org/maven2"
}
maven {
url "https://cdn.lfrs.sl/repository.liferay.com/nexus/content/groups/public"
}
}
}

3、在build.gradle中增加需要的引用
比如增加spring mvc 、Acitiviti的依赖包,

dependencies {

compile 'com.liferay.portal:com.liferay.portal.kernel:2.0.0'
compile 'com.liferay.portal:com.liferay.util.bridges:2.0.0'
compile 'com.liferay.portal:com.liferay.util.taglib:2.0.0'
compile 'com.liferay:com.liferay.application.list.api:1.0.0'
compile 'javax.portlet:portlet-api:2.0'
compile 'javax.servlet:javax.servlet-api:3.0.1'
compile 'org.osgi:org.osgi.service.component.annotations:1.3.0' compileOnly group: "jstl", name: "jstl", version: "1.2"
compileOnly group: "org.osgi", name: "org.osgi.compendium", version: "5.0.0"
compileOnly group: "org.activiti", name: "activiti-engine", version: "5.21.0" compile 'org.springframework:spring-webmvc:4.1.6.RELEASE'
compile 'org.springframework:spring-webmvc-portlet:4.1.6.RELEASE'
compile 'org.springframework:spring-aop:4.1.6.RELEASE'
compile 'org.springframework:spring-context:4.1.6.RELEASE'
compile 'org.springframework:spring-core:4.1.6.RELEASE'
compile 'org.springframework:spring-expression:4.1.6.RELEASE'
compile 'org.springframework:spring-web:4.1.6.RELEASE'
compile 'org.springframework:spring-beans:4.1.6.RELEASE'
compile 'org.springframework:spring-jdbc:4.1.6.RELEASE'
compile 'org.slf4j:slf4j-log4j12:1.7.6'
compile 'org.slf4j:slf4j-api:1.7.6' } tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}

然后,再项目右键"Gradle" >> "Refresh gradle project"

4、编译、部署,见图1

5、调试,Debug 〉〉 然后选一个Liferay 7.XX server

然后手动添加新建的portlet

发现liferay7的调试非常方便,无论是修改了jsp还是java文件,可以立即(大概3-5秒)重新自动部署,调试简单又快捷。

Liferay7 BPM门户开发之27: MVC Portlet插件工程开发的更多相关文章

  1. Liferay7 BPM门户开发之36: 使用Portlet filters过滤器做切面AOP

    使用Portlet filters过滤器做切面AOP Portlet Filters定义于JSR286 Java Portlet Specification 2.0 Portlet Filters是为 ...

  2. Liferay7 BPM门户开发之37: Liferay7下的OSGi Hook集成开发

    hook开发是Liferay客制扩展的一种方式,比插件灵活,即可以扩展liferay门户,也能对原有特性进行更改,Liferay有许多内置的服务,比如用hook甚至可以覆盖Liferay服务. 可作为 ...

  3. Liferay7 BPM门户开发之17: Portlet 生命周期

    Portlet 生命周期 init() =〉 render() =〉 processAction() =〉 processEvent() =〉 serveResource() =〉destroy() ...

  4. Liferay7 BPM门户开发之10: 通用流程实现从Servlet到Portlet(Part1)

    开发目的: 实现通用流程自动化处理(即实现不需要hardcode代码的bpm统一处理后台,仅需要写少量前端html form代码和拖拽设计BPM定义) 既可独立运行或可依托于Liferay或依托其它门 ...

  5. Liferay7 BPM门户开发之26: 集成Activiti到Liferay7

    开发顺序: 实战任务1,开发BPM管理后台(用于在Liferay管理中心管理Activiti模型上传) 一个熟悉Portlet操作的项目,为开发打好基础. http://www.cnblogs.com ...

  6. Liferay7 BPM门户开发之12:acitiviti和liferay用户权限体系集成

    写到第12章才出现Liferay的内容,希望可以厚积薄发. 我们的目标是不使用不维护Activiti的用户组织架构,只维护Liferay的体系,这样的好处是非常明显的,即不用做组织架构的同步工作. 原 ...

  7. Liferay7 BPM门户开发之28: Portlet文件上传,及实体类同步更新上传

    抓住核心 . Liferay文件上传的核心就是使用UploadPortletRequest类 继承关系java.lang.Object extended byjavax.servlet.Servlet ...

  8. Liferay7 BPM门户开发之33: Portlet之间通信的3种方式(session、IPC Render Parameter、IPC Event、Cookies)

    文章介绍了5种方式,4种是比较常用的: Portlet session IPC Public Render Parameters IPC Event Cookies 参考地址: https://web ...

  9. Liferay7 BPM门户开发之44: 集成Activiti展示流程列表

    处理依赖关系 集成Activiti之前,必须搞清楚其中的依赖关系,才能在Gradle里进行配置. 依赖关系: 例如,其中activiti-engine依赖于activiti-bpmn-converte ...

随机推荐

  1. [转] MovieClip转Bitmap方法

    package { import flash.display.Bitmap; import flash.display.BitmapData; import flash.display.Loader; ...

  2. shell脚本批量处理字符串

    上周五运营那边给了一份手机号码的excle,要求查询出所有对应于用户编号的用户的信息.这个时候遇到了一个问题就是,需要查询的用户数量很多,不可能一个一个去查,而excle中的格式又不符合sqlquer ...

  3. Asp.Net MVC4入门指南(1): 入门介绍

    前言 本教程将为您讲解使用微软的Visual Studio Express 2012或Visual Web Developer 2010 Express Service Pack 1 来建立一个ASP ...

  4. 【转】详解Python的装饰器

    原文链接:http://python.jobbole.com/86717/ Python中的装饰器是你进入Python大门的一道坎,不管你跨不跨过去它都在那里. 为什么需要装饰器 我们假设你的程序实现 ...

  5. Ubuntu设置squid代理

    1.安装squid sudo apt-get install squid 2,修改配置,增加需要使用代理的ip vi命令修改: vi /etc/squid/squid.conf 图形界面编辑 sudo ...

  6. 【java】:解析xml

    ==========================================xml文件<?xml version="1.0" encoding="GB231 ...

  7. 【使用git】初识git

    0. 版本控制 版本控制是一种记录若干文件内容变化,以便将来查阅特定版本修改情况的系统(vcs). svn等是集中式版本控制,即服务器在单一机器上,每次checkout变化的文件,若机器故障,则有可能 ...

  8. 1201新课程TSQL语句

    1.创建数据库 create datebase 表名称 2.删除数据库 drop datebase 表名称 3.创建表 -create table test(表名称)( code(列名称) varch ...

  9. c# 抓取Web网页数据分析

    通过程序自动的读取其它网站网页显示的信息,类似于爬虫程序.比方说我们有一个系统,要提取BaiDu网站上歌曲搜索排名.分析系统在根据得到的数据进行数据分析.为业务提供参考数据. 为了完成以上的需求,我们 ...

  10. 【原创】-- tftp安装配置及使用

    环境:Ubuntu 14.04  OK6410 环境搭建: (1) $ sudo apt-get install tftp tftpd openbsd-inetd 或者安装tftp的增强版本tftp- ...