• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
The Autobahn Has No Speed Limit - Your XPages Shouldn't Either!
 

The Autobahn Has No Speed Limit - Your XPages Shouldn't Either!

on

  • 1,280 views

Using XPages out of the box lets you build good-looking and well-performing applications. As XPage applications become bigger and more complex, performance can become an issue. There are several ways ...

Using XPages out of the box lets you build good-looking and well-performing applications. As XPage applications become bigger and more complex, performance can become an issue. There are several ways to improve scalability and performance that you should take into consideration. In this webinar, learn how to use partial refresh and partial execution mode and how to monitor its execution using a JSFLifeCycle monitor to avoid multiple re-calculations. See how readily available tools from OpenNTF will allow you to profile and analyze your code to improve the speed of your applications. Using Server Side Java Script and encountering a significant slow down when using Script Libraries? Learn how you can improve the speed of your application using JAVA instead of JavaScript, JSON and even @formulas.

Statistics

Views

Total Views
1,280
Views on SlideShare
1,273
Embed Views
7

Actions

Likes
1
Downloads
37
Comments
0

1 Embed 7

http://www.linkedin.com 7

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    The Autobahn Has No Speed Limit - Your XPages Shouldn't Either! The Autobahn Has No Speed Limit - Your XPages Shouldn't Either! Presentation Transcript

    • The Autobahn Has no Speed Limit – Your XPages Shouldn’t Either Tweet about this event: #xpages and mention us: @teamstudio @TLCCLTD @eknori October 17, 2013
    • Taline Badrikian Marketing Director @teamstudio teamstudio.com @TLCCLTD @eknori
    • Who we are • Our background is in creating tools for collaborative computing in mid-size and large enterprises, primarily for Lotus Notes • Easy-to-use tools for developers and administrators • 2300+ active customers, 47 countries • Offices in US, UK and Japan • Entered mobile space in 2010 with Unplugged – easy mobilization of Notes apps to Blackberry, Android and iOS
    • Teamstudio Unplugged • Your Mobile Domino Server – take your Notes apps with you! • End users access Notes applications from mobile devices whether online or offline • Leverages existing skills and technology – XPages – Replication model you already know • IBM Collaboration Solutions Award Winner 2013
    • Teamstudio Continuity • Mobile BCM application for smartphones and tablets – iOS, Android and BB • • • Offline access to all your BCM and Disaster Recovery data Store plans, contacts, call trees, and more Client available for download from app stores
    • Teamstudio • Next webinar November 19th • DCLUG – October 24th • BLUG All Things Mobile – October 29th • Promotions: – Chance to win an iPad mini when you get a demo of Teamstudio Continuity
    • The Autobahn has no speed limit - Your XPages shouldn't either! Your Host Today: Paul Della-Nebbia TLCC @PaulDN #XPages 1
    • Upcoming and Recorded Webinars Next Webinar on November 19th www.tlcc.com/xpages-webinar View Previous Webinars (use url above) 2
    • TLCC Courses and Services • The Leader in Notes and Domino Training since 1997 • Self Paced Distance Learning Courses for Notes/Domino – XPages, Development, and Administration (user too!) – Learn anywhere using your Notes client – Many demos and activities – An Instructor is a click away • OnSite Private Classes • TLCC Mentoring Services 3
    • What’s New at TLCC  Free course – Introduction to XPages Development (both 8.5 and 9.0)  New Courses! • Notes Domino 9 Application Development 1 • Notes Domino 9 Application Development Update • Java 1 for XPages Development (9.0) • Notes Domino 9 System Administration Update • Notes Domino 9 System Administration 1  New Packages! • XPages and JavaScript for Domino 9 Package • XPages and Rapid Development for Domino 9 Package • XPages, JavaScript and Rapid Development for Domino 9 Package  TLCC’s Fall Sale – Extended to Oct. 31st 4
    • XPages Skills Path Suggested TLCC Skills Path at TLCC.com Core Notes/Domino Skills Domino Object Model skills LotusScript or Java Rapid XPages Development (user interface controls) XPages Development 2 JavaScript for XPages Developers XPages Development 1 Mobile XPages Development Java for XPages TLCC Can Help: • • • • • Self Paced Courses Instructor Led Online OnSite Private Instructor Led Blended Learning Custom courses 5
    • Asking Questions Q & A at the end! Type in your questions as they come up 6
    • Your Presenters Today: Howard Greenberg IBM Champion Founding Partner TLCC @TLCCLtd Ulrich Krause IBM Champion Senior Software Architect BCC @Eknori, @bccffm #XPages 7
    • About: Ulrich Krause • Administrator /Developer since 1993 • Senior Software Architect at BCC, Germany • OpenNTF Contributor • IBM Champion 2011/2012/2013 • • • • • Blog http://www.eknori.de Web http://www.bcc.biz Forum (de) (http://www.atnotes.de) Twitter @eknori Mail ulrich.krause@eknori.de 8
    • Agenda • What factors affect Performance? • JSF Lifecycle Listener • Partial Update / Partial Execute • Tools • Coding Factors – ViewNavigator vs. GetItemValue – SSJS vs. Java – Stringbuilder • Questions??? 9
    • XPages Request 10
    • Hardware • The hardware used has a significant influence on performance. There are 3 key elements: – CPU – Main Memory – Hard Disk 11
    • Hardware • Main Memory – Limit defined by the operating system  Scalability • CPU – Cores / Clock / Cache  Poor response time • Weak CPU AND Low Memory – Poor overall performance – Poor response times – Server "hangs" 12
    • Network • Latency – Time taken for data transmission between multiple computers on a network • Bandwidth – Rate of transmission of data • Greater Bandwidth + Lower Latency -------------------------------= Better Connection 13
    • Client & Browser • Hardware • How many data requests / responses are transmitted • How much data is transferred (size) • Caching of resources • How much CSJS runs • Size / complexity of the CSS • Complexity of the site structure 14
    • Limiting factors on performance • Browser / HTTP server – Network latency – distance/time to server. – Bandwidth – size of files. – Browser limits on concurrent downloads • IE7 allows 2 downloads, IE8 allows 6 • HTTP Server / App Server – HTTP Server JVM heap size & garbage collector – CPU time, competition between threads, gives slower response times – Threads, limited to 40 by default 15
    • Limiting factors on performance • App Server / Domino context – Read design elements from the NSF (XPage .class files, form structure, etc) – Backend API calls may be expensive, especially for large data sets – Design elements may be network requests 16
    • Limiting factors on performance • Servlet / Lifecycle – Restore control tree – file system read. Control tree locking – no concurrent access – Rendered re-evaluated for every control for most phases • Browser/Client JavaScript/Dojo – Inline JavaScript blocks insertion of later HTML elements into the DOM tree – Dojo does AJAX requests for .js files for dojo modules that are not loaded 17
    • General Performance Options • notes.ini – HTTPJVMMaxHeapSizeSet=1 – HTTPJVMMaxHeapSize=256M • Should be set to ¼ of the available RAM • Domino Administrator – HTTP server Disable Logging – HTTP server thread count defaults to 40 • link to IBM article • Debugging enabled in notes.ini ? – JavaEnableDebug=1 – JavaDebugOptions=transport=dt_socket,server=y,suspen d=n,address=8000 – JavascriptEnableDebug=1 18
    • Reducing Memory Utilization • xsp.persistence.mode= – Defines the persistence mode for the JSF pages • file: All the pages are persisted on disk • fileex: All the pages are persisted on disk except the current one, which stays in memory • <else>: All the pages stay in memory (tree mode) 19
    • JavaScript/CSS Aggregation • Groups many DOJO, CSS / JS files into a single file – Less requests from the browser to the server – Performance improvements on networks with high latency – Enhanced performance parsing CSS / JS – Fewer connections to the server On the Server: xsp.properties: xsp.resources.aggregate=true 20
    • JavaScript/CSS Aggregation 21
    • XPages PreLoad • XPagesPreload=1 • New Feature in Notes / Domino 8.5.3 • Works on Server and Client • Java classes from the XPages runtime plug-ins loaded from a fixed list of runtime classes ( 435 in ND 8.5.3 ) – com.ibm.xsp.core, common utility, JS wrapper, FSF runtime classes • Java classes referenced in *-faces.config.xml – XPages control renderer, data sources, complex types 22
    • XPages PreLoad • XPagesPreloadDB = Server!!Db.nsf/XPage.xsp, myLocalDb.nsf • Works at the application level • The application is loaded on the client / server startup into memory – This happens even when the application is first opened in the browser 23
    • XPages PreLoad (cont.) • For each entry in the notes.ini variable, an XPage URL is generated and sent to the server • The application is loaded, and the HTML generated • The XPages runtime discards the HTML, but retains the application in memory 24
    • Scoped Variables • applicationScope – Are visible for all users of one application – Expires some time after the last user used an applicationScope variable – applicationScope variables are NOT persistent forever • sessionScope – Is valid through the session of the current user – A user session expires after some time of inactivity – Uses don't have access to the sessionScope variables of other users 25
    • Scoped Variables (cont.) • viewScope – Is visible for views on the current page only. – Useful for transporting a search query to a view. • requestScope – Is valid through one request of the current user. – That includes refreshing of a page. 26
    • Caching with Application Scope 27
    • Next Up: Howard Greenberg IBM Champion Founding Partner TLCC @TLCCLtd #XPages 28
    • JSF Life Cycle - Post Request Restore View •Restore component tree •Events: •afterRestoreView Apply Request Values •Copy data to Editable controls Process Validations •Validations •Converters Update Model Values •Move values to data source Invoke Application •Application logic •Events: •onClientLoad (XPage, etc) •on… events of button, etc. Render Response •Convert to HTML, etc. •Events: •beforeRenderReponse •afterRenderResponse Response 29
    • Lifecycle1 XPage – Initial Page Load Render Response • Rendered property for id: label1 • Label property for id: label1 • Rendered property for id: inputText1 • Default value property for id: inputText1 • Rendered property for id: label2 • Rendered property for id: comboBox1 • values property for id: comboBox1 • values property for id: comboBox1 • Rendered property for id: computedField1 • Value property for id: computedField1 • Rendered property for id: computedField2 • Value property for id: computedField2 30
    • Lifecyle1 – Submit (Full Update) Restore View Apply Request Values (8) •Rendered property for id: label1 •Rendered property for id: inputText1 •Rendered property for id: inputText1 •Rendered property for id: label2 •Rendered property for id: comboBox1 •Rendered property for id: comboBox1 •Rendered property for id: computedField1 •Rendered property for id: computedField2 Update Model Values (8) •Rendered property for id: label1 •Rendered property for id: inputText1 •Rendered property for id: inputText1 •Rendered property for id: label2 •Rendered property for id: comboBox1 •Rendered property for id: comboBox1 •Rendered property for id: computedField1 •Rendered property for id: computedField2 Invoke Application (1) •OnClick event for id: button1 39 SSJS Calls Process Validations (11) •Rendered property for id: label1 •Rendered property for id: inputText1 •Rendered property for id: inputText1 •Validation for inputText1 •Default value property for id: inputText1 •Rendered property for id: label2 •Rendered property for id: comboBox1 •Rendered property for id: comboBox1 •values property for id: comboBox1 •Rendered property for id: computedField1 •Rendered property for id: computedField2 Render Response (11) •Rendered property for id: label1 •Label property for id: label1 •Rendered property for id: inputText1 •Rendered property for id: label2 •Rendered property for id: comboBox1 •values property for id: comboBox1 •values property for id: comboBox1 •Rendered property for id: computedField1 •Value property for id: computedField1 •Rendered property for id: computedField2 •Value property for id: computedField2 31
    • When to Execute - # vs $ <xp:label id="label1"> <xp:this.value> <![CDATA[#{javascript:return “My Label”;}]]> </xp:this.value> </xp:label> • # is Compute dynamically – Executed every time the page is rendered – Use for values that are likely to change • $ is Compute on Page Load – Executed when the page is first loaded – Use for values that don't change 32
    • Lifecyle2 – Submit (Full Update) - On Page Load Restore View Changed all Rendered and Values (comboBox) to only compute on Page Load Update Model Values •Rendered property for id: label1 •Rendered property for id: inputText1 •Rendered property for id: inputText1 •Rendered property for id: label2 •Rendered property for id: comboBox1 •Rendered property for id: comboBox1 •Rendered property for id: computedField1 •Rendered property for id: computedField2 Apply Request Values •Rendered property for id: label1 •Rendered property for id: inputText1 •Rendered property for id: inputText1 •Rendered property for id: label2 •Rendered property for id: comboBox1 •Rendered property for id: comboBox1 •Rendered property for id: computedField1 •Rendered property for id: computedField2 Invoke Application (1) •OnClick event for id: button1 6 SSJS Calls, saved 33 Process Validations (2) •Rendered property for id: label1 •Rendered property for id: inputText1 •Rendered property for id: inputText1 •Validation for inputText1 •Default value property for id: inputText1 •Rendered property for id: label2 •Rendered property for id: comboBox1 •Rendered property for id: comboBox1 •values property for id: comboBox1 •Rendered property for id: computedField1 •Rendered property for id: computedField2 Render Response (3) •Rendered property for id: label1 •Label property for id: label1 •Rendered property for id: inputText1 •Rendered property for id: label2 •Rendered property for id: comboBox1 •values property for id: comboBox1 •values property for id: comboBox1 •Rendered property for id: computedField1 •Value property for id: computedField1 •Rendered property for id: computedField2 •Value property for id: computedField2 33
    • But I need dynamic Rendering! Options for dynamically computing the Rendered: • Scoped variables – Still get calculated but do the heavy lifting once and then read the scoped variable in the Rendered property • DataContexts – Compute a value at the Xpage or Panel level once – Refer to the value using EL (much faster than SSJS) 34
    • DataContext • Can be thought of as global variables • Value can be computed dynamically or on page load – Warning: Computing dynamically has performance impact • Can be scoped to any level that a data source can – XPage, Custom Control or Panel – Set a dataContext in a panel in a repeat control to avoid multiple references to a NotesDocument's item • Can be referenced using EL – Benefit: Not having to go through the SSJS parser 35
    • DataContext - Pitfall • Be careful binding data context variables dynamically – They will be recomputed multiple times, even when in partial execution mode and if they are not in use (six times!) • Apply Request Values • Process Validations • Update Model Values • Invoke Application • Twice in Render Response! • If computed on page load then only computed once on page load • See Paul Withers blog entry to learn how to set a data context value via code 36
    • Partial Refresh vs. Partial Execution? • Partial Refresh (Update) – Computes entire XPage, only sends back what is in the partial refresh id (refreshId) • Partial Execution – Only calculates what is in the area specified (execId) 37
    • Partial Refresh Demo - Results Restore View Apply Request Values (8) •Rendered property for id: label1 •Rendered property for id: inputText1 •Rendered property for id: inputText1 •Rendered property for id: label2 •Rendered property for id: comboBox1 •Rendered property for id: comboBox1 •Rendered property for id: computedField1 •Rendered property for id: computedField2 Update Model Values (8) •Rendered property for id: label1 •Rendered property for id: inputText1 •Rendered property for id: inputText1 •Rendered property for id: label2 •Rendered property for id: comboBox1 •Rendered property for id: comboBox1 •Rendered property for id: computedField1 •Rendered property for id: computedField2 Invoke Application (1) •OnClick event for id: button1 Only Savings were here! 30 SSJS Calls, saved 9 Process Validations (11) •Rendered property for id: label1 •Rendered property for id: inputText1 •Rendered property for id: inputText1 •Validation for inputText1 •Default value property for id: inputText1 •Rendered property for id: label2 •Rendered property for id: comboBox1 •Rendered property for id: comboBox1 •values property for id: comboBox1 •Rendered property for id: computedField1 •Rendered property for id: computedField2 Render Response (2) •Rendered property for id: label1 •Label property for id: label1 •Rendered property for id: inputText1 •Rendered property for id: label2 •Rendered property for id: comboBox1 •values property for id: comboBox1 •values property for id: comboBox1 •Rendered property for id: computedField1 •Value property for id: computedField1 •Rendered property for id: computedField2 •Value property for id: computedField2 38
    • Partial Refresh Pros and Cons • Pros – Reduced control processing in the render response phase – Smaller response from server • Means reduced network usage – Better UI experience • Rest of the page is still visible while waiting for a response • Cons – Controls like computed fields outside refresh area don’t refresh – Be careful turning this on for a completed XPage (TEST!) – Can only update one area (one id) • Workaround on Tim Tripcony blog here 39
    • Partial Execution Demo - Results Restore View 16 SSJS Calls Saved 13 Update Model Values (1) •Rendered property for id: label1 •Rendered property for id: inputText1 •Rendered property for id: inputText1 •Rendered property for id: label2 •Rendered property for id: comboBox1 •Rendered property for id: comboBox1 •Rendered property for id: computedField1 •Rendered property for id: computedField2 Apply Request Values (1) •Rendered property for id: label1 •Rendered property for id: inputText1 •Rendered property for id: inputText1 •Rendered property for id: label2 •Rendered property for id: comboBox1 •Rendered property for id: comboBox1 •Rendered property for id: computedField1 •Rendered property for id: computedField2 Invoke Application (1) •OnClick event for id: button1 Process Validations (1) •Rendered property for id: label1 •Rendered property for id: inputText1 •Rendered property for id: inputText1 •Validation for inputText1 •Default value property for id: inputText1 •Rendered property for id: label2 •Rendered property for id: comboBox1 •Rendered property for id: comboBox1 •values property for id: comboBox1 •Rendered property for id: computedField1 •Rendered property for id: computedField2 Render Response (12) •Rendered property for id: label1 •Label property for id: label1 •Rendered property for id: inputText1 •Default value property for id: inputText1 •Rendered property for id: label2 •Rendered property for id: comboBox1 •values property for id: comboBox1 •values property for id: comboBox1 •Rendered property for id: computedField1 •Value property for id: computedField1 •Rendered property for id: computedField2 •Value property for id: computedField2 40
    • Partial Execution Pros and Cons • Pros – Reduced processing in the 3 data-processing phases • Cons – Control with onClick event has to be inside the execId area – Editable values outside of the executed area do not get submitted/updated (reset to default values) – Existing XPages need analysis/testing before using this • Current onclick events might refer to controls where the data is not submitted – ExecMode available in 8.5.1 – Have to use source to enter ExecId (in 8.5, 9.0 has Designer UI) 41
    • Partial Refresh AND Execution Demo - Results Restore View Apply Request Values (1) •Rendered property for id: label1 •Rendered property for id: inputText1 •Rendered property for id: inputText1 •Rendered property for id: label2 •Rendered property for id: comboBox1 •Rendered property for id: comboBox1 •Rendered property for id: computedField1 •Rendered property for id: computedField2 •Rendered property for id: computedField2 Update Model Values (1) •Rendered property for id: label1 •Rendered property for id: inputText1 •Rendered property for id: inputText1 •Rendered property for id: label2 •Rendered property for id: comboBox1 •Rendered property for id: comboBox1 •Rendered property for id: computedField1 •Rendered property for id: computedField2 Invoke Application (1) •OnClick event for id: button1 6 SSJS Calls, saved 33 Process Validations (1) •Rendered property for id: label1 •Rendered property for id: inputText1 •Rendered property for id: inputText1 •Validation for inputText1 •Default value property for id: inputText1 •Rendered property for id: label2 •Rendered property for id: comboBox1 •Rendered property for id: comboBox1 •values property for id: comboBox1 •Rendered property for id: computedField1 •Rendered property for id: computedField2 Render Response (2) •Rendered property for id: label1 •Label property for id: label1 •Rendered property for id: inputText1 •Rendered property for id: label2 •Rendered property for id: comboBox1 •values property for id: comboBox1 •values property for id: comboBox1 •Rendered property for id: computedField1 •Value property for id: computedField1 •Rendered property for id: computedField2 •Value property for id: computedField2 42
    • disableValidators= true • • • • All phases (1-6) occur Turns off all validators Converters continue to work Items in documents will be updated Restore View Apply Request Values Process Validations Update Model Values Invoke Application Render Response •No Validators get executed here! 43
    • Immediate = true • JSF Lifecycle processes only phases (1, 2, 6) • No data processing • Items in documents are not updated • Onclick event handler scripts and render response calculations are performed Restore View Apply Request Values Process Validations Update Model Values Invoke Application Render Response 44
    • Using the loaded Property Loaded only computed once in the createView phase • Loaded = true – Not in component tree or memory • Loaded = false – Control is not created – Can never be rendered or accessed – Saves memory too 45
    • Life Cycle Performance Suggestions • Most properties, like CSS “style” are only computed in the RenderResponse phase • Watch and minimize: – Rendered property (when dynamic) • Computed multiple times! • Use dataContexts or scoped variables when able • Use both Partial Refresh (Update) and Partial Execute when able 46
    • Watch Out for @DbLookup • @DbLookup about 3-4 times slower than SSJS – res = @DbLookup(db,"CustomersByNameView",names[i], "phone"); vs. – doc = vw.getDocumentByKey(names[i], true); res = doc.getItemValueString("phone"); • Five lookups repeated 100 times – @DbLookup averaged about 1728ms – getDocumentByKey averaged 510ms • Other @Functions not tested 47
    • Next Up: Ulrich Krause IBM Champion Senior Software Architect BCC @Eknori, @BCCFFM #XPages 48
    • Images • Use correct file type depending on content – JPEG for complex and detailed images – PNG/GIF for simple images, fonts, transparencies • Use the HTML <img> tag “width” and “height” attributes • For faster HTML layout in the browser – Size the image to size you intend to use • Resizing using html attributes height and width will delay the rendering of your page • Images larger than necessary will waste bandwidth 49
    • Image Sprites • Use CSS Image Sprites – If you have multiple small images, make a single larger image containing the smaller images – Use CSS to display only the relevant subset image at a location in the page – For semantically significant sprites, provide an accessibility “title” attribute (as sprites don't use the IMG “alt” attribute, but you still want to assist blind users) – There's no specific XPages support for sprites, but they're used in the XPages OneIU themes 50
    • CSS Image Sprite Sample http://www.w3schools.com/css/tryit.asp?filename=trycss_sprites_img 51
    • XPages Toolbox • XPages based Application – Runs on the Domino server or the Notes client – An NSF needs to be installed on the server/Notes client – A profiler jar file should be added to the JVM launch options • Measures CPU performance and memory allocation • Available from OpenNTF.org – Free open source project • http://www.openntf.org/internal/home.nsf/project.xsp?action=open Document&name=XPages%20Toolbox • Extended in 8.5.2 to support backend classes profiling 52
    • XPages Toolbox 53
    • XPages Toolbox • Generate a heap dump of the JVM running in the HTTP task – A button in the XPages profiler generates the heap dump – From the Domino console • tell http xsp heapdump (triggers com.ibm.jvm.Dump.HeapDump()) • tell http xsp javadump (triggers com.ibm.jvm.Dump.JavaDump()) • Analyze the heap dump using the Eclipse memory analyzer – http://www.eclipse.org/mat/ – http://www.ibm.com/developerworks/java/jdk/tools/dtfj.html 54
    • Heapdump / Javadump Analyzer 55
    • More Tools • Print statements – In rendered/visible computations to see how often executed • print("panel2 evaluating rendered property"); – In the XPages root control events: • before/afterPageLoad, afterRestoreView, before/afterRenderResponse – Custom control root events: • before/afterPageLoad – In the document data source events: • queryNewDocument, postSaveDocument, etc. • Task Manager and/or Process Explorer – Shows CPU usage & process memory usage as it happens 56
    • More Tools • Browser developer tools – for watching network transactions, partial updates, response times – BROWSER: Firebug, Developer Tools – XPiNC: FirebugLite from ExtLib • Java / Javascript Debugging – Degrades performance but can inspect objects • Use the Eclipse Java debugger – In Dominonotes.ini add these 2 options: • JavaEnableDebug=1 • JavaDebugOptions=transport=dt_socket,server=y,suspend=n,add ress=8000 57
    • Optimization – Step By Step 58
    • Step 1: Original Code From Sample • Read all Contacts into a NotesDocumentCollection, loop the collection and build the JSON by reading the values from items in the document 59
    • Step 1: Result 60
    • Step 2: Store UNID in an item • Get all Contacts into a NotesDocumentCollection, loop the collection and build the JSON by reading the values from items in the document. Also UNID is stored in document 61
    • Step 2: Result 62
    • Step 3: Build JSON on document save • Get all Contacts into a NotesDocumentCollection, loop the collection and get the JSON from an item on the document. JSON is calculated on document save 63
    • Step 3: Result 64
    • Step 4: Read JSON from view with ViewNavigator 65
    • Step 4: Result 66
    • StringBuilder vs String.concat • Concatenation of Strings is very easy in Java - all you need is a + • Each time you append something via + (String.concat()) a new String is created, the old stuff is copied, the new stuff is appended, and the old String is thrown away. The bigger the String gets the longer it takes - there is more to copy and more garbage is produced. • Accordingly to Arno Unkrig the optimal strategy is to use String.concat() for 2 or 3 operands, and StringBuilder for 4 or more operands 67
    • StringBuilder vs String.concat • Use StringBuilder whenever you assemble a String in a loop – Keep in mind that + isn't always a good idea 68
    • Step 5: Use a StringBuilder to concat the JSON 69
    • Step 5: Result 70
    • Step 6: Use Java instead of SSJS Xpage SSJS Code Java Code 71
    • Step 6: Result 72
    • Homework Time – Further References • IBM article on JSF (non XPages) • Paul Withers blog (each link below is different) – Part 1, Part 2, Part 3 • Tony McGuckin’s Video - XPages Master class – 4 videos plus sample applications 73
    • Questions???? Use the Q&A pane in WebEx to ask questions We will answer your questions verbally 74
    • Question and Answer Time! Howard Greenberg Ulrich Krause Upcoming Events: TLCC Fall Sale – ends 10/31 IBM Connect 2014 Registration is now open Paul Della-Nebbia Taline Badrikian #XPages @Eknori @TLCCLtd @Teamstudio @PaulDN @BCCFFM TLCC Questions? howardg@tlcc.com paul@tlcc.com 888-241-8522 or 561-953-0095 Teamstudio Questions? contactus@teamstudio.com 877-228-6178 75