LifeRay Portal 6 study notes 5-1: Struts Portlet Development Example

Create Action Class

package com.liferay.portlet.strutsdemo;

Java code
  1. import javax.portlet.ActionRequest;
  2. import javax.portlet.ActionResponse;
  3. import javax.portlet.PortletConfig;
  4. import javax.portlet.RenderRequest;
  5. import javax.portlet.RenderResponse;
  6. import org.apache.struts.action.ActionForm;
  7. import org.apache.struts.action.ActionForward;
  8. import org.apache.struts.action.ActionMapping;
  9. import com.liferay.portal.struts.PortletAction;
  10. public class StrutsAction extends PortletAction {
  11. public void processAction (ActionMapping mapping, ActionForm form,
  12. PortletConfig config, ActionRequest req, ActionResponse res)
  13. throws Exception {
  14. String name = req.getParameter ("name");
  15. if (null == name | | "". equals (name)) {
  16. setForward (req, "sturts_portlet.err");
  17. } Else {
  18. setForward (req, "sturts_portlet.success");
  19. }
  20. }
  21. public ActionForward render (ActionMapping mapping, ActionForm form,
  22. PortletConfig config, RenderRequest req, RenderResponse res)
  23. throws Exception {
  24. if (getForward (req)! = null & &! getForward (req). equals ("")) {
  25. return mapping.findForward (getForward (req));
  26. } Else {
  27. return mapping.findForward ("sturts_portlet.view");
  28. }
  29. }
  30. }

Success and error pages are not written, can be prepared according to your needs

Portlet deployment

Open the Ant interface, Eclipse - "show views -" ant build file to add, find the following build.xml file Ext project, click on the


Complete, start the liferay-tomcat

In the browser, enter **localhost:8080, login, add the portlet

LifeRay Portal 6 study notes 5-1: Struts Portlet Development Example

LifeRay Portal 6 study notes 5-1: Struts Portlet Development Example
标签: string name, java code, amp, import org, eclipse, public void, tomcat, deployment, interface, apache struts, sturts
分类: Java
时间: 2010-10-29


  1. LifeRay Portal 6 Study Notes 6: Using Struts2 Portlet Development

    Prepared Liferay Version: 6.0.4 Development model: General plug-mode (non-Ext) Struts Version: Environ ...
  2. LifeRay Portal 6 study notes 6-1: Using Struts2 Portlet Development

    java file Java code import com.opensymphony.xwork2.ActionSupport; public class StrutsDemo extends ActionSuppor ...
  3. LifeRay Portal 6 Study Notes 5: Struts Portlet Development Example

    This referred to Struts Portlet in Ext environment is developed using liferay bundles of Struts 1.2 Developmen ...
  4. LifeRay Portal 6 Study Notes 3: Liferay IDE's installation

    Liferay Portal 6 in 23 had a small version of the update, the current version is 6.04, is mainly a large numbe ...
  5. LifeRay Portal 6 Study Notes 2: Liferay Portal6 installation and simple setup

    Ready First to 20Portal/6.0.3 Download liferay-plugins- ...
  6. LifeRay Portal 6 Study Notes 8: Liferay some of the commonly used tools

    Beginning from the early version of Liferay provides some good tools packages, are familiar with these tools c ...
  7. LifeRay Portal 6 Study Notes 7: Liferay some frequently asked questions

    1, how to delete tomcat bound inside the sample database Liferay 5.2 started from downloading Liferay There is ...
  8. Liferay Portal 6 Study Notes 4: Liferay development model introduced

    This introduces the liferay development model liferay recommend two development models First, plug pattern of ...
  9. Oracle study notes (7) subroutine and package development PLSQL

    Haha, Ching Ming Festival holiday to go back a bit, it was so wonderful to go home feeling nice ah! Now again ...
  10. 5.Liferay Portal deployment descriptor

    Section VI Liferay Portal deployment descriptor As with all Web applications, Liferay Portal using multiple XM ...
  11. 1.Liferay Portal Framework Analysis

    Preface ... 5 The first part of the Liferay Portal Framework Analysis ... 6 Chapter Liferay Portal. 6 Section ...
  12. [Transfer] SAP Study Notes (SAP Portal Study Notes 1)

    SAP Study Notes (SAP Portal Study Notes 1) In general SAP Portal project consultants, including most of the co ...
  13. Struts2 Study Notes 1 --- HelloWorld

    Struts2 study notes first: environmental structures and the HelloWorld implementation. 1, build Struts2 enviro ...
  14. Java code reuse (SSH Study Notes 1)

    Often and for a code dealing with people, code reuse is very important. When we develop a system inevitably wi ...
  15. 10 struts2 java study notes

    Recently I have spare time Java Virtual Machine Research, the intern assigned to the project team inside, do n ...
  16. One study notes struts2 (PART 1. Struts2 Introduction and Configuration)

    One study notes struts2 (PART 1. Struts2 Introduction and Configuration) First, the development environment ID ...
  17. Liferay Portal Introduction

    liferay is a ready-made, which means that the use, fully functional portal Liferay Portal, is a perfect combin ...
  18. 企业门户平台 Liferay Portal

    Liferay Portal 网站 : Liferay 是一个完整的门户解决方案,基于J2EE的应用,使用了EJB以及JMS等技术,前台界面部分使用Struts MVC 框 ...
  19. ROR Study Notes 1

    Installed at the success of ROR environment (yes, I installed InstantRails-2.0-win), the first thing done is t ...