Introduction to portlet development Carla Carrubba (carla.carrubba
by user
Comments
Transcript
Introduction to portlet development Carla Carrubba (carla.carrubba
Introduction to portlet development Carla Carrubba ([email protected]) INFN Dpt. Of Catania Giuseppina Inserra ([email protected]) INFN Dpt. Of Catania Web course on the development of applications for Catania Science Gateways, 16 July 2013 Outline Introduction Portlet Life cycle Modes Files Integrated Development Enviroment MyFirst Portlet Introduction What is a portlet? Portlet is pluggable user interface software component that is managed and displayed in a web portal. Portlet applications, have become a Java standard: the JSR-168 standard defines the Portlet 1.0 specification, and the JSR-286 standard defines the Portlet 2.0 specification. JSR-168/286 standard portlets should be deployable on any portlet container. Introduction Where use a portlet? In a portlet container. We have chosen the award winning Liferay portal framework which offers a rich, easy-to- use "web 2.0" interface using AJAX and other presentation layer technologies. Liferay (www.liferay.com): is a portal framework designed to be a single web-based environment from which all of a user’s applications can run, and these applications are integrated together in a consistent and systematic way. Why use a portlet? Portlets Portlet Sc. Gtwy E Sc. Gtwy D Sc. Gtwy C Sc. Gtwy B Sc. Gtwy A Introduction Portlet: Life Cycle Portlet: Life Cycle Class GenericPortlets { init (PortletConfig); processAction (ActionRequest, ActionResponse); render (RenderRequest, RenderResponse); destroy(); doView (Request, Response); doEdit (Request, Response); doHelp (Request, Response); } Portlet Modes A portlet works in three different states: View Mode: generates a markup ( a portion of a web page) Edit Mode: allows portlet customisation and setting preferences Help Mode: explains portlet functionalities Action Request doView() Action Request Render Request doEdit() view.jsp view2.jsp edit.jsp processAction() doHelp() help.jsp Render request Render Request view.jsp doView() view2.jsp Portlet: Data exchange Interaction between jsp pages and java code Application Server (Glassfish) JSP page <jsp:useBean <form … > Java code Class <you portlet> Extends GenericPortlet … <input … /> </form> • JSP uses <form… statements to send parameters to Java code • Java code extends class GenericPortlet overriding methods: Init, doView, doHelp, doEdit, processAction • Java code uses 2 Classes to exchange data from/to JSPs Portlet Files (root) Used by ‘ant’ to compile and deploy the portlet Define here JSP’s styles JSP image files JavaScript files Portlet JSP pages Portlet files(WEB-INF) Used to define database and other resources settings Jar Library directory (local scope) Java source files Tag library descriptors for XML file Portlet configuration files Integrated Development Enviroment Thank you Question? MyFirst-Portlet Hands on!! Wiki on myFirstPortlet Download and Deploy myFirst-portlet View myFirst-portlet on your Liferay bundle Customize myFirst-portlet in your personal portlet Test your personal portlet