Portlet Application Development Example

Source: Internet
Author: User
Tags ibm developerworks
Objective:Develop a portlet application that conforms to the JSR-168 standard and deploys it to the Jetspeed2. Familiarize yourself with the development process of portlet applications and understand JETSPEED2 support for portlet applications. Background information:JSR-168 Standard: The Portlet Specification 1.0 final version, which was released by Java Community Process (JCP) on October 7, 2003. Defines a standard interface for portlet applications. Get wide support from the industry. content:        1, portlet application code        the Portlet application described in this article is made by IBM Developerworks provides a simple Hello world example. Includes the Doview method to display a JSP page. The Processaction method in the portlet is used to process data submitted from forms in the JSP, and the resulting data is placed in a Java bean, which is also placed in portletsession for JSP file invocation. Detailed description and source download can see: http://www-128.ibm.com/developerworks/cn/websphere/library/techarticles/yangjiang/0402_jsr168/ JSR168PORTLET.HTML?CA=DWCN-NEWSLETTER-WSDD          2, edit package         requires two standard libraries for editing: Portlet-api-1.0.jar and Pluto-1.0.1.jar.        Note: Do not include these two class libraries when packing. Because it is already in the tomcat/shared/lib, otherwise it will be reported cannot create Portlet instance error.        package The project file into a Web archive file using the JDK Jar command.          3, Release        copy the Helloworld.war files to/ The Jetspeed/web-inf/deploy directory can be. The system is automatically deployed to the portal.          4, calling        In page editing state, the portlet selector appears when you click the new portlet. There will be a new "HelloWorld portlet" application. Check to make sure you can add it to the page.          There is a simpler way to show portlets. Add a fragment definition to the Default-page.psml file in the/jetspeed/web-inf/pages directory. <fragment id= "dp-19" type= "Portlet" name= "Helloworld::helloworldportlet" >             <property name= "Row" value= "6"/>             <property name= "column" value= "0"/> </fragment>        of which:             ID is any item             name is a combination of ${portlet.application.id} and ${portlet.name}.            ${portlet.application.id} is the actual war filename; ${portlet.name For <portlet-name> defined in Portlet.xml.           row, column is the position on the page.   &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; 5, error and resolution        when the application is deployed to the page, it is found that it does not display correctly, and the portlet is not available error. After the analysis of the log, the original JETSPEED2 does not support PropertyManager container services. The Renderrequest.getproperty ("Wps.markup") is used in the code to obtain the value of this initialization parameter.        Modify the program to obtain the value of the parameter by initialization. private static String Defaultmarkupsource = "";      /**      * Initialize portlet configuration.      *     public void init (Portletconfig config) throws Portletexception  & nbsp;    {        super.init (config);            Defaultmarkupsource = Config.getinitparameter ("Wps.markup");      }   private static string Getjspfilepath (Renderrequest request, String Jspfile) & nbsp;     {       //string markup = Request.getproperty (" Wps.markup ");         String markup = Defaultmarkupsource;           if (markup = null)            {            markup = Getmarkup ( Request.getresponsecontenttype ());          &nbsp}           return Jsp_folder + markup + "/" + Jspfile + "." +         getjspextension (markup);      }          recompile deployment, the application can be displayed normally.   Summary:JETSPEED2.0 supports the JSR-168 standard, and portlet applications can be easily deployed to the Jetspeed2.0 and are easy to operate. The application can run normally. The disadvantage is that the property Manager service is not supported, causing some portlet applications to migrate difficultly. reference materials:Yangjiang, "Hello World, a simple JSR portle t", http://www-128.ibm.com/developerworks/cn/websphere/library/techarticles/ YANGJIANG/0402_JSR168/JSR168PORTLET.HTML?CA=DWCN-NEWSLETTER-WSDD 2004-02-01

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.