3rd annual plex/2e worldwide users conference page based on title slide from slide layout palette....

23
3rd Annual Plex/2E Worldwide Users Conference 13D Using XML Generated from Plex Apps to Create Dynamic Web Pages Jeremy Yearron, Desynit September 21, 2007

Upload: rachel-archer

Post on 26-Mar-2015

222 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 3rd Annual Plex/2E Worldwide Users Conference Page based on Title Slide from Slide Layout palette. Design is cacorp 2006. Title text for Title or Divider

3rd Annual Plex/2E Worldwide Users Conference

13D Using XML Generated from Plex Apps to Create Dynamic Web Pages

Jeremy Yearron, Desynit

September 21, 2007

Page 2: 3rd Annual Plex/2E Worldwide Users Conference Page based on Title Slide from Slide Layout palette. Design is cacorp 2006. Title text for Title or Divider

2 April 10, 2023 Using XML Generated from Plex Apps to Create Dynamic Web Pages Copyright © 2007 Desynit Ltd

Bio Slide

> Jeremy Yearron

> Desynit Ltd, Consultant

> Plex using most generators since 1995, Java

> UK, [email protected]

> Other facts

I live on a boat travelling around the UK

I rebuild canals

I created Builders Mate

Page 3: 3rd Annual Plex/2E Worldwide Users Conference Page based on Title Slide from Slide Layout palette. Design is cacorp 2006. Title text for Title or Divider

3 April 10, 2023 Using XML Generated from Plex Apps to Create Dynamic Web Pages Copyright © 2007 Desynit Ltd

Overview

> XML & transformations

> Retrieving XML out of Plex apps

> Displaying data Examples & demos

Embedding output

> Controlling forms Examples & demos

Page 4: 3rd Annual Plex/2E Worldwide Users Conference Page based on Title Slide from Slide Layout palette. Design is cacorp 2006. Title text for Title or Divider

4 April 10, 2023 Using XML Generated from Plex Apps to Create Dynamic Web Pages Copyright © 2007 Desynit Ltd

XML

> The de facto standard for data exchange.

Page 5: 3rd Annual Plex/2E Worldwide Users Conference Page based on Title Slide from Slide Layout palette. Design is cacorp 2006. Title text for Title or Divider

5 April 10, 2023 Using XML Generated from Plex Apps to Create Dynamic Web Pages Copyright © 2007 Desynit Ltd

Transforming & Formatting

> eXtensible Stylesheet Language (XSL) XML to describe the change/format

Split into subprojects

XSL

XSLT XSL-FO

Page 6: 3rd Annual Plex/2E Worldwide Users Conference Page based on Title Slide from Slide Layout palette. Design is cacorp 2006. Title text for Title or Divider

6 April 10, 2023 Using XML Generated from Plex Apps to Create Dynamic Web Pages Copyright © 2007 Desynit Ltd

Formatting

> XSL-Formatting Objects

> Describes content of document

> Precise formatting of page layout

> Initially for printing, but now also PDFs

<fo:table table-layout="fixed"text-align="start"border-spacing="10pt"><fo:table-column column-width="3cm" padding-after="0.2cm"/><fo:table-body>...</fo:table-body>

</fo:table>

Page 7: 3rd Annual Plex/2E Worldwide Users Conference Page based on Title Slide from Slide Layout palette. Design is cacorp 2006. Title text for Title or Divider

7 April 10, 2023 Using XML Generated from Plex Apps to Create Dynamic Web Pages Copyright © 2007 Desynit Ltd

Transformation

> XSLT

> Identifies elements to process Uses XPath to navigate through document

> Defines data to be output Can be XML, HTML, XSL-FO, Text, etc

<xsl:template match="Field”><fo:table-row height="16pt">

<xsl:apply-templates select="*"/></fo:table-row>

</xsl:template>

Page 8: 3rd Annual Plex/2E Worldwide Users Conference Page based on Title Slide from Slide Layout palette. Design is cacorp 2006. Title text for Title or Divider

8 April 10, 2023 Using XML Generated from Plex Apps to Create Dynamic Web Pages Copyright © 2007 Desynit Ltd

Demo Setup

> Java Tomcat application server

Servlet for web requests

Xerces, Xalan & FOP for XML/XSL

Listener for handling Plex function calls

> Plex functions Accept data, output XML

> Stylesheets

Page 9: 3rd Annual Plex/2E Worldwide Users Conference Page based on Title Slide from Slide Layout palette. Design is cacorp 2006. Title text for Title or Divider

9 April 10, 2023 Using XML Generated from Plex Apps to Create Dynamic Web Pages Copyright © 2007 Desynit Ltd

Demo Setup

Browser Servlet

Tomcat

XSL Processor

Listener

Fnc

JVM

FncFnc

Fnc

Page 10: 3rd Annual Plex/2E Worldwide Users Conference Page based on Title Slide from Slide Layout palette. Design is cacorp 2006. Title text for Title or Divider

10

April 10, 2023 Using XML Generated from Plex Apps to Create Dynamic Web Pages Copyright © 2007 Desynit Ltd

XML From Plex

> Pattern to wrap BlockFetch, SingleFetch and update functions

> Outputs generic XML document

Page 11: 3rd Annual Plex/2E Worldwide Users Conference Page based on Title Slide from Slide Layout palette. Design is cacorp 2006. Title text for Title or Divider

11

April 10, 2023 Using XML Generated from Plex Apps to Create Dynamic Web Pages Copyright © 2007 Desynit Ltd

Simple Transformation

> Apply single transformation

XSL Processor

XMLXMLHTMLXSL-FOTEXT

XSL

Page 12: 3rd Annual Plex/2E Worldwide Users Conference Page based on Title Slide from Slide Layout palette. Design is cacorp 2006. Title text for Title or Divider

12

April 10, 2023 Using XML Generated from Plex Apps to Create Dynamic Web Pages Copyright © 2007 Desynit Ltd

Better Scenario

> Create standard Document describing content

> Convert to presentation format

XSL Processor

XMLXMLHTMLXSL-FOTEXT

XSL

XSL Processor

XSL

Document content

Presentation

Page 13: 3rd Annual Plex/2E Worldwide Users Conference Page based on Title Slide from Slide Layout palette. Design is cacorp 2006. Title text for Title or Divider

13

April 10, 2023 Using XML Generated from Plex Apps to Create Dynamic Web Pages Copyright © 2007 Desynit Ltd

Examples

> Customers & Orders Html, PDF

Page 14: 3rd Annual Plex/2E Worldwide Users Conference Page based on Title Slide from Slide Layout palette. Design is cacorp 2006. Title text for Title or Divider

14

April 10, 2023 Using XML Generated from Plex Apps to Create Dynamic Web Pages Copyright © 2007 Desynit Ltd

Merging Documents

> Controller XSL processes XML and template together

> Template determines output format

XSL Processor

XMLXMLHTMLXSL-FOTEXT

XSL

XSL Processor

XSL

Document content

Controller

XML

Template

Page 15: 3rd Annual Plex/2E Worldwide Users Conference Page based on Title Slide from Slide Layout palette. Design is cacorp 2006. Title text for Title or Divider

15

April 10, 2023 Using XML Generated from Plex Apps to Create Dynamic Web Pages Copyright © 2007 Desynit Ltd

Examples

> Invoices Creates page for each ‘Row’ in document

Conditional elements

Page 16: 3rd Annual Plex/2E Worldwide Users Conference Page based on Title Slide from Slide Layout palette. Design is cacorp 2006. Title text for Title or Divider

16

April 10, 2023 Using XML Generated from Plex Apps to Create Dynamic Web Pages Copyright © 2007 Desynit Ltd

Embedding Output

> Can embed output within another page iFrame

Server side scripting, e.g. ASP or JSP

– Use wrapper class

<tr> <td> <% XslTest.PlexDataAccess pda = new XslTest.PlexDataAccess("GetCustomerSFXml", "EmbedCust");

pda.addParam("CustomerNo", "1");%> <%= pda.getData() %> </td></tr>

Page 17: 3rd Annual Plex/2E Worldwide Users Conference Page based on Title Slide from Slide Layout palette. Design is cacorp 2006. Title text for Title or Divider

17

April 10, 2023 Using XML Generated from Plex Apps to Create Dynamic Web Pages Copyright © 2007 Desynit Ltd

Tag Libraries

> Define <...> tags to represent Java code

> Removes code from web page design

<%@ taglib prefix="plex" uri="WEB-INF/plexTags.tld"%>

<tr> <td><plex:embedXsl function="GetCustomerSFXml"

stylesheet="EmbedCust"><plex:param name="CustomerNo" value="1"/>

</plex:embedXsl></td></tr>

Page 18: 3rd Annual Plex/2E Worldwide Users Conference Page based on Title Slide from Slide Layout palette. Design is cacorp 2006. Title text for Title or Divider

18

April 10, 2023 Using XML Generated from Plex Apps to Create Dynamic Web Pages Copyright © 2007 Desynit Ltd

AJAX

> Asynchronous JavaScript And XML

> Uses http request object in browser

> Server returns XML

> JavaScript processes XML

> Can respond to user actions

> E.g. Google Maps

Page 19: 3rd Annual Plex/2E Worldwide Users Conference Page based on Title Slide from Slide Layout palette. Design is cacorp 2006. Title text for Title or Divider

19

April 10, 2023 Using XML Generated from Plex Apps to Create Dynamic Web Pages Copyright © 2007 Desynit Ltd

Communication

> XMLHttpRequest object

> Browser specific implementationif (window.XMLHttpRequest)

req = new XMLHttpRequest();else if (window.ActiveXObject)

req = new ActiveXObject("Microsoft.XMLHTTP");

> Define function to handle returned XMLreq.onreadystatechange = xmlHandler;

> Send data to a URLreq.open("POST", “/getData/Customer”, true);req.send(“CustomerNo=" + keyValue);

Page 20: 3rd Annual Plex/2E Worldwide Users Conference Page based on Title Slide from Slide Layout palette. Design is cacorp 2006. Title text for Title or Divider

20

April 10, 2023 Using XML Generated from Plex Apps to Create Dynamic Web Pages Copyright © 2007 Desynit Ltd

JavaScript

> Original intention of developers

> Navigate through Object Model of XML documentvar xmldoc = req.responseXML.documentElement;var value = xmldoc.childNodes[1].text;var nodes = xmldoc.getElementsByTagName(childName);

> Use DHTML to display contentvar html = “<td>” + value + “</td>”;document.getElementById(“myField”).innerHTML = html;

Page 21: 3rd Annual Plex/2E Worldwide Users Conference Page based on Title Slide from Slide Layout palette. Design is cacorp 2006. Title text for Title or Divider

21

April 10, 2023 Using XML Generated from Plex Apps to Create Dynamic Web Pages Copyright © 2007 Desynit Ltd

Uses

> Enhancing basic web app Load list according to user selection

Fly-over text

> Full UI Grids

Edit forms

Page 22: 3rd Annual Plex/2E Worldwide Users Conference Page based on Title Slide from Slide Layout palette. Design is cacorp 2006. Title text for Title or Divider

22

April 10, 2023 Using XML Generated from Plex Apps to Create Dynamic Web Pages Copyright © 2007 Desynit Ltd

Examples

> Order Detail EditSuite

Page 23: 3rd Annual Plex/2E Worldwide Users Conference Page based on Title Slide from Slide Layout palette. Design is cacorp 2006. Title text for Title or Divider

23

April 10, 2023 Using XML Generated from Plex Apps to Create Dynamic Web Pages Copyright © 2007 Desynit Ltd

Questions

?