Top Banner
Enhancing a Grid Portlet Using JavaScript Phil Chung Komla Etse John Nipp
14

Enhancing a Grid Portlet Using JavaScript Phil Chung Komla Etse John Nipp.

Apr 01, 2015

Download

Documents

Kaleigh Barks
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Enhancing a Grid Portlet Using JavaScript Phil Chung Komla Etse John Nipp.

Enhancing a Grid Portlet Using JavaScript

Phil Chung

Komla Etse

John Nipp

Page 2: Enhancing a Grid Portlet Using JavaScript Phil Chung Komla Etse John Nipp.

Assignment Overview

• Explore another way to create the portlet.

• 6a uses separate .java file for portlet’s logic.

• Use JavaScript to embed the Portlet’s logic directly in the code for the Portlet’s java server page (.jsp).

Page 3: Enhancing a Grid Portlet Using JavaScript Phil Chung Komla Etse John Nipp.

Quick Overview of Java

• Created by Netscape in 1995

• Purpose was to make web pages more interesting

• An interpreted language– Scripts are not compiled prior to runtime– Statements processed at execution time

• An object-based scripting language

Page 4: Enhancing a Grid Portlet Using JavaScript Phil Chung Komla Etse John Nipp.

Implementing JavaScript in the Porlet Design

• Still use the MainPage.jsp file

• Include JavaScript within the HTML to create dynamic effects– Overcomes static nature of HTML.

Page 5: Enhancing a Grid Portlet Using JavaScript Phil Chung Komla Etse John Nipp.

Installing JavaScript Libraries

• Dojo Toolkit– Open source Dynamic-HTML (DHTML) toolkit

written in JavaScript. – www.dojotoolkit.org

Page 6: Enhancing a Grid Portlet Using JavaScript Phil Chung Komla Etse John Nipp.

Simple JavaScript Script

Example of JavaScript instructions embedded within the HTML code<html><head><script type = “text/javascript”>

Document.write(“This is file from inline HTML code.”)</script></head><body></body></html>

Page 7: Enhancing a Grid Portlet Using JavaScript Phil Chung Komla Etse John Nipp.
Page 8: Enhancing a Grid Portlet Using JavaScript Phil Chung Komla Etse John Nipp.

<script type="text/javascript"> dojo.require("dojo.widget.TitlePane");

dojo.hostenv.writeIncludes(); dojo.require("dojo.widget.TabContainer"); dojo.require("dojo.widget.LinkPane");

dojo.require("dojo.widget.ContentPane");dojo.require("dojo.widget.LayoutContainer");dojo.require("dojo.widget.Checkbox");

dojo.require("dojo.widget.AccordionContainer");dojo.require("dojo.widget.SplitContainer");

dojo.require("dojo.widget.*"); </script>

Page 9: Enhancing a Grid Portlet Using JavaScript Phil Chung Komla Etse John Nipp.

<div class="main"> <div class="content" style="height:420px;"> <div dojoType="AccordionContainer" labelNodeClass="label" containerNodeClass="accBody" style="border: 1px solid #F9966B;HEIGHT:410px" id="mainaccordi">

<div id ="googlemap" dojoType="ContentPane" label="Google Map"> <form action="#" onsubmit="showAddress(this.address.value); return false"> <div id="googlemap2" style="width:1150px;height:300px"></div> <p> <b>Location:</b> <input type="text" size="60" name="address" value="1500 Marlynn Dr, Charlotte, NC" /> <input type="submit" value="Go!" /> </p> </form> </div>

<div dojoType="SplitContainer" label="Email" open="true">

Page 10: Enhancing a Grid Portlet Using JavaScript Phil Chung Komla Etse John Nipp.

Inserting JavaScript Code for Creation of Google Maps Interface

<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAs91yCKatVZLSfyAUX3XJoxTwM0brOpm-All5BF6PoaKBxRWWERS2dI38LDyFef5VuB_jxekyAh-yXg" type="text/javascript"></script>

Page 11: Enhancing a Grid Portlet Using JavaScript Phil Chung Komla Etse John Nipp.
Page 12: Enhancing a Grid Portlet Using JavaScript Phil Chung Komla Etse John Nipp.
Page 13: Enhancing a Grid Portlet Using JavaScript Phil Chung Komla Etse John Nipp.
Page 14: Enhancing a Grid Portlet Using JavaScript Phil Chung Komla Etse John Nipp.

End