创建Action类
package com.liferay.portlet.strutsdemo;
- 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;
-
- import com.liferay.portal.struts.PortletAction;
-
-
- public class StrutsAction extends PortletAction {
-
-
- public void processAction(ActionMapping mapping, ActionForm form,
- PortletConfig config, ActionRequest req, ActionResponse res)
- throws Exception {
- String name = req.getParameter("name");
- if (null == name || "".equals(name)) {
- setForward(req, "sturts_portlet.err");
- } else {
- setForward(req, "sturts_portlet.success");
- }
- }
-
- 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("sturts_portlet.view");
- }
- }
-
- }
成功和错误页面不在写,可以根据自己的需要编写了
部署Portlet
打开Ant界面,Eclipse--》show views--》ant 添加build文件,找到Ext工程下面的build.xml文件,点击其中的
Direct-deploy。
完成之后,启动liferay-tomcat
在浏览中输入http://localhost:8080,登录,添加portlet
分享到:
相关推荐
liferay-portal-sql-6.1.1-ce-ga2-20120731132656558
liferay portal比较完整的学习资料,供大家学习
Portlet之间的通信--- Liferay 内部Portlet通信-Liferay中的示例Portlet 示例:从Portlet A输入标题,并使用Portlet B在同一页面上显示标题。
内容如下: Portal介绍 Liferay Portal6安装及简单设置 Liferay IDE的安装使用 Liferay开发模式介绍 Struts Portlet开发示例 使用Struts2开发Portlet
Liferay Spring Portlet MVC 使用 Maven 的 Liferay Spring Portlet MVC 项目模板。 Liferay EE 6.2.10.11 (GA1, SP... $ cp target/liferay-spring-mvc-portlet.war $LIFERAY_HOME/deploy/ 配置 默认设置为 Liferay
liferay-portal-src-6.0.6-20110225.part2
Vaadin Hibernate Portlet 示例这是将移植到 Liferay portlet 并移植到使用 Maven 构建的尝试。...下载/安装先决条件吉特生命射线出于本示例的目的,我们假设您将 Liferay 解压缩到您的主目录: cd ~unzip liferay-port
liferay-gis-portlet
liferay-portal-src-6.0.6-20110225.part1
liferay-portal-src-6.0.6-20110225.part5
liferay-portal-doc-6.0.6-20110225.part1
liferay-portal-tomcat-5.5-5.1.1.part1.rar
liferay-portal-tomcat-5.5-5.1.1.part4.rar
liferay-portal-tomcat-5.5-5.1.1.part2.rar
liferay-portal-tomcat-5.5-5.1.1.part3.rar
liferay-portal-sql-6.1.2-ce-ga3-20130816114619181.zip包,移植liferay建库需要用到
liferay-portal-doc-6.0.6-20110225.part2
liferay-portal-src-6.0.6-20110225.part3
liferay-portal-src-6.0.6-20110225.part4
liferay-portal-sql-oracle-10-5.2.3.dmp