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

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的依赖包,

  1. dependencies {
  2.  
  3. compile 'com.liferay.portal:com.liferay.portal.kernel:2.0.0'
  4. compile 'com.liferay.portal:com.liferay.util.bridges:2.0.0'
  5. compile 'com.liferay.portal:com.liferay.util.taglib:2.0.0'
  6. compile 'com.liferay:com.liferay.application.list.api:1.0.0'
  7. compile 'javax.portlet:portlet-api:2.0'
  8. compile 'javax.servlet:javax.servlet-api:3.0.1'
  9. compile 'org.osgi:org.osgi.service.component.annotations:1.3.0'
  10.  
  11. compileOnly group: "jstl", name: "jstl", version: "1.2"
  12. compileOnly group: "org.osgi", name: "org.osgi.compendium", version: "5.0.0"
  13. compileOnly group: "org.activiti", name: "activiti-engine", version: "5.21.0"
  14.  
  15. compile 'org.springframework:spring-webmvc:4.1.6.RELEASE'
  16. compile 'org.springframework:spring-webmvc-portlet:4.1.6.RELEASE'
  17. compile 'org.springframework:spring-aop:4.1.6.RELEASE'
  18. compile 'org.springframework:spring-context:4.1.6.RELEASE'
  19. compile 'org.springframework:spring-core:4.1.6.RELEASE'
  20. compile 'org.springframework:spring-expression:4.1.6.RELEASE'
  21. compile 'org.springframework:spring-web:4.1.6.RELEASE'
  22. compile 'org.springframework:spring-beans:4.1.6.RELEASE'
  23. compile 'org.springframework:spring-jdbc:4.1.6.RELEASE'
  24. compile 'org.slf4j:slf4j-log4j12:1.7.6'
  25. compile 'org.slf4j:slf4j-api:1.7.6'
  26.  
  27. }
  28.  
  29. tasks.withType(JavaCompile) {
  30. options.encoding = 'UTF-8'
  31. }

然后,再项目右键"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. ajax头像上传

    html代码: <input id="fileinput" type="file" /><br /> <br /> < ...

  2. Selenium2+python自动化11-定位一组元素find_elements

    前言 前面的几篇都是讲如何定位一个元素,有时候一个页面上有多个对象需要操作,如果一个个去定位的话,比较繁琐,这时候就可以定位一组对象. webdriver 提供了定位一组元素的方法,跟前面八种定位方式 ...

  3. 心情闲适,发几个tatanic的图

    第一次看这个是98年在高一的同学家里. 唯一的月末休息时,那时没有电话,老父以为我会在下午到caojp,结果老父在寒风中等我一个下午,发火了.

  4. [Chapter 3 Process]Practice 3.8: Describe the differences among short-term, medium-term, long-term scheduling

    3.8 Describe the differences among short-term, medium-term, and longterm scheduling. 答案: 长期调度决定哪些进程进 ...

  5. 隐藏 input 标签的边框

    css input 如何去掉点击后出现的边框:css文件里加:*:focus { outline: none; } 或 input {outline:none;} 去边框的方法如下 方法1: < ...

  6. 用JQuery的Ajax对表进行处理的一些小笔记

    --示例INSERT INTO 表名 ( 参数 )VALUES(@+参数),new SqlParameter("@参数", 值);注:配合SqlHelper使用. 一.Load() ...

  7. Linux搭建SVN服务器(centos)

    http://wenku.baidu.com/link?url=0SnbE5pQG8K-RKnPlKcdesMWxS5YC64glkk5sCyxHorR37nX-qa4w0ViWLp55oDnRpTn ...

  8. 在指定控件位置弹出popup window

    先看效果图 黄色的就是弹出的popup window 首先自定义一个view用来显示,文件名为layout_my_view.xml <?xml version="1.0" e ...

  9. 第二章——建立一个HelloWorld项目,练习使用git的add/commit/push/pull/fetch/clone等基本命令。比较项目的新旧版本的差别-----答题者:徐潇瑞

    1.首先下载安装git,很简单所以就不详细说了,当弹出一个类似的命令窗口的东西,就说明Git安装成功 2.因为Git是分布式版本控制系统,所以需要填写用户名和邮箱作为一个标识 3.接着,注册githu ...

  10. Jquery DOM元素的方法

    jQuery DOM 元素方法 函数 描述 .get() 获得由选择器指定的 DOM 元素. .index() 返回指定元素相对于其他指定元素的 index 位置. .size() 返回被 jQuer ...