Copyright © Liferay, Inc.

Slides:



Advertisements
Similar presentations
Struts Portlet Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written permission.
Advertisements

Struts Portlet Adding an Action Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without.
JSF Portlet Backing Beans and UI Components Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in.
MC365 Application Servers: Servlets. Today We Will Cover: What a servlet is The HTTPServlet and some of its more important methods How to configure the.
Object-Oriented Enterprise Application Development Tomcat 3.2 Configuration Last Updated: 03/30/2001.
Starting with Gridsphere Albert Einstein Institute Gridsphere Installation.
JavaServer Faces. Objectives To implement dynamic web pages with JavaServer Faces (JSF) technology To learn the syntactical elements of JavaServer Faces.
Tomcat Organization Deploying applications. Confusion Like a web server Root locations are from a defined directory location In addition… from that point.
Jsp. JBoss Many servers (like JBoss and Glassfish) are Tomcat servers. The file structures and format for deployment are the same. Where (in what server.
Portlet Deployment Albert Einstein Institute Deploying JSR portlet applications to GridSphere.
Apache Tomcat Representation and Management of Data on the Web.
Objectives:1. Investigate the Web application deployment descriptor 2. Install and deploy Tomcat and struts 3. Design and deploy a struts application Struts.
Tomcat Configuration A Very, Very, Very Brief Overview.
Coypright (c) Ning Chen, Ph.D CPSC 425 Java Enterprise Application Programming Presented by Ning Chen, Ph.D. Chair/Professor Department of Computer.
Web Applications Basics. Introduction to Web Web features Clent/Server HTTP HyperText Markup Language URL addresses Web server - a computer program that.
ECE356 – Database Systems Lab 1 – Building a Web Project with NetBeans Tiuley Alguindigue Lab Instructor – University of Waterloo, E & CE Dept. Fall 2013.
Introduction to Liferay Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written.
Struts Portlet Database Interaction Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without.
Basic Portlet Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written permission.
JSF Portlet Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written permission.
Introduction to Java web programming Dr Jim Briggs JWP intro1.
Java Enterprise Edition Java Web Development Structure of a web project Introduction to Web Applications The first project Introduction to Java Web Development.
Themes & Layout Tutorial Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written.
End User Administration (in context of Liferay CMS) Copyright © 2006 Liferay, LLC All Rights Reserved. No material may be reproduced electronically or.
Ext Environment Copyright © 2005 Liferay, LLC All Rights Reserved. No material may be reproduced electronically or in print without written permission.
Struts Portlet Redirect Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written.
Java Servlets CS-422. Application Mapping Your servlet application will be mapped to a directory structure: –“myapp” maps to some directory C:/docs/apps/myapp.
CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES LECTURE 5_1 George Koutsogiannakis/ Summer
AN OVERVIEW OF SERVLET TECHNOLOGY SERVER SETUP AND CONFIGURATION WEB APPLICATION STRUCTURE BASIC SERVLET EXAMPLE Java Servlets - Compiled By Nitin Pai.
Creating Adjudicators in a WAR Computer Science Innovations, LLC.
JavaServer Faces Jeff Schmitt October 5, Introduction to JSF Presents a standard framework for building presentation tiers for web applications.
Guidelines for Homework 6. Getting Started Homework 6 requires that you complete Homework 5. –All of HW5 must run on the GridFarm. –HW6 may run elsewhere.
Ext Environment Copyright © 2005 Liferay, LLC All Rights Reserved. No material may be reproduced electronically or in print without written permission.
JSF Introduction Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written permission.
Basic Setup Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written permission.
Java Servlets example using NetBeans 6. Pre-requirements: Install Java JDK 1.6 Install NetBeans IDE 6 (we will use version NetBeans IDE update 16)
1 ® Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 1 Building Portlets with ColdFusion Pete Freitag Foundeo, Inc.
J2EE Overview Web Programming CSCI J2EE multi-tier architecture Servlet: Java class loaded into Web server JSP page: enhanced HTML page that is.
LDAP Authentication Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written permission.
Topic Java EE installation (Eclipse, glassfish, etc.) Eclipse configuration for EE Creating a Java Web Dynamic Project Creating your first servlet.
Bloomer User Notes Installing and Running a Bloomer Installation Jack Park Latest: Project Home:
JSP Portlet Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written permission.
Installing and Configuring Tomcat SSE. Downloading Tomcat l Download url: 4.0/release/v4.1.24/bin/
Database Connection Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written permission.
Basic Portlet Copyright © 2000 – 2007 Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written permission.
Modern Programming Language. Web Container & Web Applications Web applications are server side applications The most essential requirement.
15 Copyright © 2004, Oracle. All rights reserved. Adding JAAS Security to the Client.
 2003 Prentice Hall, Inc. All rights reserved Deploying a Web Application ( may include.war )
Tomcat Setup BCIS 3680 Enterprise Programming. One-Click Tomcat Setup 2  This semester we’ll try to set up Tomcat with a PowerShell script.  Preparation.
Google App Engine using Java 1. Outline Getting started Guestbook example Todo example Simplified Madlib 2.
Required Tools Copyright © 2005 Liferay, LLC All Rights Reserved. No material may be reproduced electronically or in print without written permission from.
WS-PGRADE + ASM Basic hands-on Zoltán Farkas, MTA SZTAKI
Examples with Java Server Faces (covered topics)
APACHE TOMCAT WEB SERVER
Copyright © Liferay, Inc.
JSP (Java Server Page) JSP is server side technology which is used to create dynamic web pages just like Servlet technology. This is mainly used for implementing.
Advanced Java Programming
Course Outcomes of Advanced Java Programming AJP (17625, C603)
Developing the Tools Montreal 2004
Sri Vatsav Konreddy CIS 764 FALL 2007
Unit 6-Chapter 2 Struts.
Basic hands-on Zoltán Farkas, MTA SZTAKI
JSF Portlet Navigation and Event Listeners
J2EE Application Development
The Model Layer What is Model?
Create a Portlet Project in RAD
JSF Portlet Message Bundles
XML Outline 1 XML 2 DTD.
Java Servlets and JSP.
Introduction to Java Servlets
Presentation transcript:

Copyright © 2000-2007 Liferay, Inc. JSF Portlet Copyright © 2000-2007 Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written permission from Liferay, Inc.

Objective The goal of this tutorial is to create a Java Server Faces (JSF) Portlet within Liferay Define the portlet portlet.xml liferay-portlet.xml Define the page flow and layout faces-config.xml Create the JSP index.jsp

Directory Structure Starting with Liferay version 4.2 we've made it possible to develop portlets in a deployable *.war format. This tutorial will adhere to the specs of this new feature.

Directory Structure 1) Go to: http://www.liferay.com/web/guest/downloads/samples 2) Download: “Sample JSF MyFaces Portlet” 3) Change the directory name to: library_jsf_portlet.war 4) This will be a template war that we modify for this tutorial. Copy library_jsf_portlet.war to …ext\portlets

Directory Structure Configuration files (*.xml) are located in this directory: …\ext\portlets\library_jsf_portlet.war\WEB- INF JSPs will be placed in this directory: …\ext\portlets\library_jsf_portlet.war

web.xml The web.xml is a standard web application descriptor file that is required by any J2EE servlet container such as Tomcat. In this case we have a *.war file that is being deployed onto Tomcat, and the web.xml file describes the portlet application. This configures our JSF implementation as well as the necessary hooks into the portal.

web.xml <?xml version="1.0"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <display-name>library_jsf_portlet</display-name> <context-param> <param-name>company_id</param-name> <param-value>liferay.com</param-value> </context-param> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>client</param-value> <param-name>javax.faces.application.CONFIG_FILES</param-name> <param-value>/WEB-INF/faces-config.xml</param-value>

<listener> <listener- class>com.liferay.portal.kernel.servlet.PortletContextListener</listener-class> </listener> <listener- class>org.apache.myfaces.webapp.StartupServletContextListener</listener- class> <servlet> <servlet-name>library_jsf_portlet</servlet-name> <servlet-class>com.liferay.portal.kernel.servlet.PortletServlet</servlet-class> <init-param> <param-name>portlet-class</param-name> <param- value>com.sample.jsfmyfaces.portlet.MyFacesGenericPortlet</param-value> </init-param> <load-on-startup>0</load-on-startup> </servlet> <servlet-name>FacesServlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup>

<servlet-mapping> <servlet-name>library_jsf_portlet</servlet- name> <url-pattern>/library_jsf_portlet/*</url-pattern> </servlet-mapping> <servlet-name>FacesServlet</servlet-name> <url-pattern>/faces/*</url-pattern> <taglib> <taglib-uri>http://java.sun.com/portlet</taglib-uri> <taglib-location>/WEB-INF/tld/liferay- portlet.tld</taglib-location> </taglib> </web-app>

portlet.xml The portlet.xml is the portlet descriptor per the JSR-168 spec.

portlet.xml <?xml version="1.0"?> <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"> <portlet> <portlet-name>library_jsf_portlet</portlet-name> <display-name>library_jsf_portlet</display-name> <!--<portlet-class>org.apache.myfaces.portlet.MyFacesGenericPortlet</portlet- class>--> <portlet-class>com.sample.jsfmyfaces.portlet.MyFacesGenericPortlet</portlet- class> <init-param> <name>default-view</name> <value>/index.jsp</value> </init-param> <supports> <mime-type>text/html</mime-type> </supports>

<portlet-info> <title>Library JSF Portlet</title> <short-title>Library JSF Portlet</short-title> <keywords>Library JSF Portlet</keywords> </portlet-info> <security-role-ref> <role-name>guest</role-name> </security-role-ref> <role-name>power-user</role-name> <role-name>user</role-name> </portlet> </portlet-app>

liferay-portlet.xml The liferay-portlet.xml contains Liferay- specific configurations

liferay-portlet.xml <?xml version="1.0"?> <!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 4.1.0//EN" "http://www.liferay.com/dtd/liferay-portlet- app_4_1_0.dtd"> <liferay-portlet-app> <portlet> <portlet-name>library_jsf_portlet</portlet-name> <instanceable>true</instanceable> </portlet> <role-mapper> <role-name>administrator</role-name> <role-link>Administrator</role-link> </role-mapper>

<role-mapper> <role-name>guest</role-name> <role-link>Guest</role-link> </role-mapper> <role-name>power-user</role-name> <role-link>Power User</role-link> <role-name>user</role-name> <role-link>User</role-link> </liferay-portlet-app>

liferay-display.xml The liferay-display.xml configured display settings such as which Liferay category this portlet belongs to.

liferay-display.xml <?xml version="1.0"?> <!DOCTYPE display PUBLIC "-//Liferay//DTD Display 4.0.0//EN" "http://www.liferay.com/dtd/liferay- display_4_0_0.dtd"> <display> <category name="category.test"> <portlet id="library_jsf_portlet" /> </category> </display>

Create the JSP The next step is to create the JSP Create index.jsp in the library directory …\ext\portlets\library_jsf_portlet.war\index.jsp Finally, enter “Simple JSF Portlet!” in index.jsp

index.jsp <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> <f:view> <h1> <h:outputText value="Simple JSF Portlet" /> </h1> </f:view>

Include into the build The next step is to create build file for this portlet. We must add build targets in the build.xml file. Edit build.xml here: …\ext\portlets\

build.xml <target name="compile"> <antcall target="compile-module"> <param name="module.name" value="library_jsf_portlet" /> </antcall> </target> <target name="clean"> <antcall target="clean-module">

Deploy the Files to Tomcat Once you have finished modifying all of the files, deploy them to Tomcat Open up a cmd prompt Click “Start”, “Run” and then type “cmd” Navigate to your ext\portlets directory and then type “ant deploy” …\ext\portlets>ant deploy

Check the Tomcat Directory Verify that the files were deployed to Tomcat Go to …\tomcat\webapps\ make sure that library_jsf_portlet was created Next, go to …\tomcat\webapps\library_jsf_portlet\ and open up index.jsp to see that it was deployed correctly

Check the Tomcat Directory (p.2) Go to …\tomcat\webapps\library_jsf_portlet\WE B-INF and open web.xml, portlet.xml, liferay-portlet.xml, faces-config.xml, and liferay-display.xml and check to see that the files were deployed correctly.

Final Steps Restart Tomcat Open up a new browser and type http://localhost:8080 LOGIN: test@liferay.com PASSWORD: test Click Add Content  Test Click Library JSF Portlet

Revision History Edward Shin 8/28/2006 Updated for Liferay 4.1.1 Jerry Niu 9/5/2006-9/8/2006 Updated copyright, copy edits, liferay-portal-ext slide, final steps slide edit Jerry Niu 9/27/2006 Fixed wrong tomcat deploy path James Min 01/17/2007 Converted for JSF in deployable war format Ivan Cheung 01/30/2007 Added dtd to xml config files