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

Slides:



Advertisements
Similar presentations
Apache Tiles.
Advertisements

Pure Struts web-application header.jsp footer.jsp menu.jsp body … + mybody.jsp layout.jsp struts-config.xml tiles-def.xml classical include in servlet.
Struts Portlet Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written permission.
Struts Portlet Adding an Action Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without.
MANAGE CONTENT WITH SHAREPOINT. An integrated Web-based system. An integrated Web-based system. Centrally store, manage and access documents using your.
JSF Portlet Backing Beans and UI Components Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in.
Apache Struts Technology
This presentation can be downloaded at Presented by the Office of Public Affairs Using the Cal State L.A. Web.
Web MVC-2: Apache Struts Rimon Mikhaiel
Liferay, SSO and LDAP - Integration Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without.
Object-Oriented Enterprise Application Development Tomcat 3.2 Configuration Last Updated: 03/30/2001.
Struts Basics SSE USTC Qing Ding. Agenda What is and Why Struts? Struts architecture – Controller: Focus of this presentation – Model – View Struts tag.
Apache Struts Technology A MVC Framework for Java Web Applications.
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.
Themes & Layout Tutorial Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written.
Working with SharePoint Document Libraries. What are document libraries? Document libraries are collections of files that you can share with team members.
Struts 2.0 an Overview ( )
UNIT-V The MVC architecture and Struts Framework.
A detailed guide on how to set-up your printing storefront. Please Note: Storefronts are compatible with all browsers, however for optimal use of the admin.
End User Administration (in context of Liferay CMS) Copyright © 2006 Liferay, LLC All Rights Reserved. No material may be reproduced electronically or.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
Ext Environment Copyright © 2005 Liferay, LLC All Rights Reserved. No material may be reproduced electronically or in print without written permission.
Transforming the e-Concordiensis Edward Maas Senior Capstone Design Project Advisor: Professor Cass.
McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Dynamic Action with Macromedia Dreamweaver MX Barry Sosinsky Valda Hilley.
Struts Portlet Redirect Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written.
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.
Struts J2EE web application framework “ Model 2 ” Model View Controller Controller Servlet Key features XML metadata Struts taglib Simplified form validation.
1 Welcome CMS III Workshop Employee Central.. 2 Project Sequence – Training, Workshops, Hands-on Sessions Overall Governance -- Completed/Ongoing Portal.
How to Build a Struts Application with JBuilder 9.
So – You want to learn how to put an article onto the state website. (Note: If you have not done so, you will need to review the web training provided.
LDAP Authentication Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written permission.
WSRP Portlets Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written permission.
JSR 168 Overview Copyright © 2000 – 2007 Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written permission.
FT228/3 Web Development Error processing. Introduction READ Chapter 9 of Java Server Pages from O’reilly 2 nd Edition Need to be able to 1) Diagnose and.
Content Management System Copyright © 2005 Liferay, LLC All Rights Reserved. No material may be reproduced electronically or in print without written permission.
JSP Portlet Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written permission.
Www2.computer.org Web Publishing Training Leo Wadsworth, Staff Manager April 2008.
Page Designer Storyboard J. A. Fitzpatrick December 2004.
CS562 Advanced Java and Internet Application Introduction to the Computer Warehouse Web Application. Java Server Pages (JSP) Technology. By Team Alpha.
Preface IIntroduction Objectives I-2 Course Overview I-3 1Oracle Application Development Framework Objectives 1-2 J2EE Platform 1-3 Benefits of the J2EE.
13 Copyright © 2004, Oracle. All rights reserved. Adding Validation and Error Handling.
Database Connection Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written permission.
4SCHOOLS ADDING A PHOTO GALLERY/SLIDE SHOW. ENTER USERNAME AND PASSWORD pass1234 First Initial Last Name.
Programming Fundamentals I Java Programming Spring 2009 Instructor: Xuan Tung Hoang TA: Tran Minh Trung Lab 03.
Required Tools Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written permission.
Web Site Development - Process of planning and creating a website.
2008 Freshmen Java Project Produced by 2008 IDS Freshmen.
1 /22 Accessing TaxWise Online © 2006, Universal Tax Systems, Inc. All Rights Reserved. Accessing TaxWise Online Objectives –In this chapter you will learn.
10 Copyright © 2004, Oracle. All rights reserved. Building ADF View Components.
APACHE STRUTS ASHISH SINGH TOMAR ast2124. OUTLINE Introduction The Model-View-Controller Design Pattern Struts’ implementation of the MVC Pattern Additional.
2 Copyright © 2004, Oracle. All rights reserved. ADF Development Process.
Apache Struts Technology A MVC Framework for Java Web Applications.
Invoices and Service Invoices Training Presentation for Raytheon Supply Chain Platform (RSCP) April 2016.
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
Copyright © Liferay, Inc.
Copyright © Liferay, Inc.
4Schools Adding a Web Page.
Unit 6-Chapter 2 Struts.
Basic hands-on Zoltán Farkas, MTA SZTAKI
Add Image and Title to Individual Page
JSF Portlet Message Bundles
Consult America Technology Consulting Services
Presentation transcript:

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

Overview  This PowerPoint will teach you how to create a Struts portlet  The intended audience is Java developers  The source code for this exercise is located in source-struts-1

Objectives 1.Define the JSR 168 attributes portlet-ext.xml 2.Define the Liferay-specific attributes liferay-portlet-ext.xml 3.Define the page flow struts-config.xml 4.Define the layout tiles-defs.xml 5.Create the JSP view.jsp

Why Use Struts?  Most mature and widely used technology  Centralized page flow management (struts-config.xml)  Highly scalable – allows you to separate your code into individual components

Why Use Tiles? (1)  Layouts are typically designed using include statements  In order to change the layout, you need to update each page header footer navig ation main content header footer navig ation main content header footer navig ation main content header footer navig ation main content

Why Use Tiles? (2)  With Tiles, your pages can extend a single template  Only the template needs to be changed, and all of your pages will be updated accordingly Template

High Level Overview (1)  A URL or URI is passed to the Controller  The Controller determines what page should be displayed Controller JSP URL

High Level Overview (2) struts-config.xml path="/ext/library/view" forward="portlet.ext.library.view" tiles-defs.xml name="portlet.ext.library.view" value="/portlet/ext/library/view.jsp" view.jsp /portlet/ext/library/view.jsp portlet-ext.xml view-action /ext/library/view

Directory Structure  All development for this exercise will be done in the ext-web directory ext\ext-web  All XML files will be located in the WEB-INF directory ext\ext-web\docroot\WEB-INF

portlet-ext.xml EXT_4 Library Portlet com.liferay.portlet.StrutsPortlet view-action /ext/library/view 0

text/html com.liferay.portlet.StrutsResourceBundle power-user user

liferay-portlet-ext.xml EXT_4 ext/library false

EXT_4 ext/library false  portlet-ext.xml view-action /ext/library/view

struts-config.xml struts-config.xml defines the page flow What is /ext/library/view? portlet-ext.xml: view-action /ext/library/view What is portlet.ext.library.view? It is the forward that we will use to look up the tiles definition

tiles-defs.xml tiles-defs.xml defines the page layout What is portlet.ext.library.view?  From struts-config.xml

What is /portlet/ext/library/view.jsp? For reference: portlet-ext.xml from JSP Portlet Training view-jsp /portlet/ext/jsp_portlet/view.jsp For the JSP Portlet, we pointed to the JSP directly from portlet-ext.xml. For Struts portlets, this is done through tiles-defs.xml

What is portlet? portlet is the template that we will be using (portlet.jsp). See …\portal\portal-web\docroot\WEB-INF\tiles-defs.xml for more information. What is portlet.ext.library ? portlet.ext.library extends portlet. This means that portlet.ext.library will use the portlet.jsp as its template. portlet.ext.library.view extends portlet.ext.library. This means that portlet.ext.library.view will also use portlet.jsp for its template.

Create the JSP The next step is to create the JSP  Create a directory called library here: …\ext\ext-web\docroot\html\portlet\ext  Your directory structure should now look like this: …\ext\ext-web\docroot\html\portlet\ext\library  Create view.jsp in the library directory …\ext\ext-web\docroot\html\portlet\ext\library\view.jsp  Finally, enter “Simple Struts Portlet!” in view.jsp

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 directory and then type “ant deploy”  …\ext>ant deploy

Check the Tomcat Directory Verify that the files were deployed to Tomcat  Go to …\tomcat\webapps\ROOT\WEB-INF and open portlet-ext.xml, liferay-portlet-ext.xml, struts-config-ext.xml and tiles-defs-ext.xml and check to see that the files were deployed correctly.  Next, go to …\tomcat\webapps\ROOT\html\portlet\ext\library and open up view.jsp to see that it was deployed correctly

Final Steps 1.Restart Tomcat 2.Open up a new browser and type LOGIN: PASSWORD: test 3.Click Add Content  Undefined 4.Click javax.portlet.title.EXT_4

Key Concepts portlet-ext.xml struts-config.xml tiles-defs.xml view.jsp

portlet-ext.xml view-action /ext/library/view struts-config.xml path=“/ext/library/view” forward=“portlet.ext.library.view” tiles-defs.xml name=“portlet.ext.library.view” value=“/portlet/ext/library/view.jsp” view.jsp /portlet/ext/library/view.jsp

Objectives Now that we’ve finished building the framework for our portlet, let’s move on to the next exercise. In this exercise, we will:  Create a new file called init.jsp where we will add commonly used variables and declarations  Set the portlet title  Add the portlet to a category

init.jsp Create init.jsp in the library directory …\ext\ext-web\docroot\html\portlet\ext\library\init.jsp Enter the following in init.jsp: Add commonly used variables and declarations here! What file are we including with this line? …\portal\portal-web\docroot\html\common\init.jsp This will gives us access to the Liferay tag libraries.

view.jsp  Add this line above “Simple Struts Portlet!” in view.jsp Simple Struts Portlet!  This will give us access to the init.jsp located here: …\ext\ext-web\docroot\html\portlet\ext\library\init.jsp  Ant deploy. You do not have to restart Tomcat.  The following should now be displayed: Add commonly used variables and declarations here! Simple Struts Portlet

Set the Portlet Title  Go to Language-ext.properties and add the following line: …\ext\ext-ejb\classes\content\Language-ext.properties javax.portlet.title.EXT_4=Library  Ant deploy and Restart Tomcat  The portlet title will now be “Library”

Add the Portlet to a Category  Go to liferay-display.xml and add the following line: …\ext\ext-web\docroot\WEB-INF\liferay-display.xml...  You will now be able to select your portlet from the “Test” category

Review of Key Concepts portlet-ext.xml struts-config.xml tiles-defs.xml view.jsp

portlet-ext.xml view-action /ext/library/view struts-config.xml path=“/ext/library/view” forward=“portlet.ext.library.view” tiles-defs.xml name=“portlet.ext.library.view” value=“/portlet/ext/library/view.jsp” view.jsp /portlet/ext/library/view.jsp

Review of EXT_4 ext/library false Liferay will check the struts-path to check whether a user has the required roles to access the portlet Note: When you see the error message: You do not have the required roles to access this portlet. 1.Check to see that you have defined the roles correctly in portlet-ext.xml 2.Check the to see if you have defined it correctly

Revision History Edward Shin8/28/2006Updated for Liferay Jerry Niu9/5/2006-9/8/2006 Updated copyright, copy edits, liferay-portal-ext slide, final steps slide edit Jerry Niu9/27/2006 Fixed wrong tomcat deploy path