Always Learning

Advanced Search

Mastering XPages

Mastering XPages

A Step-by-Step Guide to XPages Application Development and the XSP Language

Martin Donnelly, Mark Wallace, Tony McGuckin

Feb 2011, Paperback, 784 pages
ISBN13: 9780132486316
ISBN10: 0132486318
  • Print pagePrint page
  • Email this pageEmail page
  • Write a reviewWrite a review
  • Share

The first complete, practical guide to XPages development - direct from members of the XPages development team at IBM Lotus

Martin Donnelly, Mark Wallace, and Tony McGuckin have written the definitive programmer's guide to utilizing this breakthrough technology. Packed with tips, tricks, and best practices from IBM's own XPages developers, Mastering XPages brings together all the information developers need to become experts - whether you’re experienced with Notes/Domino development or not. The authors start from the very beginning, helping developers steadily build your expertise through practical code examples and clear, complete explanations. Readers will work through scores of real-world XPages examples, learning cutting-edge XPages and XSP language skills and gaining deep insight into the entire development process. Drawing on their own experience working directly with XPages users and customers, the authors illuminate both the technology and how it can be applied to solving real business problems.

Martin Donnelly previously led a software startup that developed and distributed small business accounting software. Donnelly holds a Commerce degree from University College Cork and an M.S. in Computer Science from Boston University.

Mark Wallace has worked at IBM for 15 years on many projects as a technical architect and application developer.

Tony McGuckin participates in the Lotus OneUI Web Application and iWidget Adoption Workgroup. He holds a bachelor's degree in Software Engineering from the University of Ulster.

The Definitive XPages Development Guide--Straight from the XPages Team at IBM Lotus

XPages is the most significant improvement to Lotus Notes/Domino development in 20 years. Now, three IBM Lotus insiders have written the definitive programmer’s guide to this breakthrough web application development framework. Packed with tips, tricks, and best practices, Mastering XPages brings together all the information you need to become an XPages expert, whether you’re experienced with Notes/Domino development or not.

The authors begin with a high-level overview of XPages: how it works, why it works that way, and why it’s such a powerful step forward. Next, you’ll install XPages and Domino Designer, and start building your expertise through practical code examples using real-world XPages applications. As you progress, you’ll master XPages from the bottom up, gain deep insight into the entire XPages development model, and discover how XPages can be used to solve everyday application development challenges.

Coverage includes

• Understanding how XPages development differs from--and is similar to--traditional Notes/Domino development

• Getting started with XPages development using Lotus Domino Designer

• Defining application metadata and binding XPages controls to Domino data

• Managing all aspects of Domino view and document data

• Navigating and linking XPages to form a cohesive application

• Building XPages business logic using various programming technologies

• Reading and writing XPage source (XSP markup) directly

• Mastering XPages programming and extensibility features, including custom controls, advanced scripting, as well as creating your very own components

• Making the most of XPages applications on the Notes client platform

• Building slick and effective application user experiences using themes

• Tuning XPages performance and maximizing application scalability

• Securing applications with Access Control Lists (ACL), Execution Control Lists (ECL), and Active Content Filtering (ACF)

Foreword by Philippe Riand xx

Preface xxiv

Part I: Getting Started with XPages 1

Chapter 1 An Introduction to XPages 3

XPages Fundamentals 3

Brand New Technology? 4

A Different Development Paradigm 5

The More Things Change, the More Things Stay the Same 7

New Horizons 7

Conclusion 8

Chapter 2 Getting Everything You Need 9

Downloads, Versions, and Locations 9

Installing Domino Designer 10

Installing Client Fix Packs 11

Client Configuration 11

Quick Tour of Domino Designer 12

Domino Designer Welcome Screen 13

Domino Designer Perspective 14

Creating a New Application 15

Creating an XPage 16

Previewing in the Notes Client 18

Previewing in a Web Browser 18

Adding a Control to an XPage 21

Conclusion 22

Chapter 3 Building Your First XPages Application 23

Laying the Foundations 24

Forms and Views 26

Building an XPages View 31

Completing the CRUD 36

Conclusion 42

Part II: XPages Development: First Principles 43

Chapter 4 Anatomy of an XPage 45

What Exactly Is an XPage? 46

Understanding XSP Tag Markup 47

Getting Started with XML 47

XPages XML Syntax 50

Simple Properties 52

Complex Properties 54

Complex Values 54

Computed Properties 55

Data Binding 59

XPages Tags 60

Data Sources 61

Domino Document 61

Domino View 62

Data Context 63

Controls 64

Editing Controls 64

Command Controls 70

Selection Controls 74

Display Controls 82

File-Handling Controls 84

Containers 87

Panel 87

Table 90

View 91

Data Table 94

Repeat 95

Include Page 99

Tabbed Panel 99

Section 100

XPage Resources 101

Script Library 101

Style Sheet 103

Resource Bundle 104

Dojo Module 105

Generic Head Resource 106

Metadata Resource 106

Converters 107

Validators 110

Simple Actions 118

Client-Side Scripting 125

HTML Tags 127

Conclusion 128

Chapter 5 XPages and JavaServer Faces 129

What Is JavaServer Faces? 130

JSF Primer 131

How Does XPages Extend JSF? 138

XML-Based Presentation Tier 141

Request Processing Lifecycle 142

User Interface Component Model 143

Standard User-Interface Components 148

Value Binding and Method Binding Expression Evaluation 152

XPages Default Variables 154

Conclusion 156

Chapter 6 Building XPages Business Logic 157

Adding Business Logic 157

Using the xp:eventHandler Tag 160

Simple Actions 167

Change Document Mode 168

Confirm Action 169

Create Response Document 170

Delete Document 171

Delete Selected Documents 172

Execute Client Script 173

Execute Script 173

Modify Field 174

Open Page 175

Publish Component Property 176

Publish View Column 177

Save Data Sources 179

Save Document 180

Set Component Mode 182

Set Value 183

Action Group 184

Using JavaScript with XPages 186

Server-Side JavaScript 186

Client JavaScript 206

Conclusion 211

Part III: Data Binding 213

Chapter 7 Working with Domino Documents 215

Domino Document Data Source 216

Creating and Editing Documents 219

Controlling URL Parameter Usage 220

Creating Response Documents 220

Executing Form Logic 224

Managing Concurrent Document Updates 227

Multiple Document Data Sources 228

Document Data Source Events 231

Common Data Source Properties 233

Miscellaneous Data Source Properties 234

Working with Domino Documents–Programmatically! 235

Simple Actions 235

JavaScript 236

Rich Documents 238

Conclusion 242

Chapter 8 Working with Domino Views 243

databaseName Property 245

View Data Source Filters 246

categoryFilter Property 246

search, searchMaxDocs Properties 249

parentId Property 251

ignoreRequestParams Property 252

keys, keysExactMatch Properties 253

Other View Content Modifiers 256

startKeys Property 256

expandLevel Property 257

A Page with Two Views 259

requestParamPrefix Property 260

When Is a View Not a View? 261

Go Fetch! Or Maybe Not... 262

loaded, scope Properties 263

postOpenView, queryOpenView Properties 263

Caching View Data 265

Sorting Columns 270

Conclusion 271

Chapter 9 Beyond the View Basics 273

Pick a View Control, Any View Control 273

The View Control: Up Close and Personal 276

Column Data Like You’ve Never Seen Before 277

Simple View Panel Make Over 279

Working with Categories 293

View Properties and View Panel Properties 301

Data Table 305

Building a Mini Embedded Profile View using a Data Table 311

Repeat Control 316

A Repeat Control Design Pattern 317

Nested Repeats 318

The Rich Get Richer 320

Some Fun with the Pager 321

Conclusion 324

Part IV: Programmability 325

Chapter 10 Custom Controls 327

Divide and Conquer 328

Getting Started with Custom Controls 329

Using Property Definitions 337

Property Tab 340

Validation Tab 343

Visible Tab 345

Property Definitions Summary 346

Using the compositeData Object 346

Send and You Shall Receive 352

Multiple Instances and Property Groups 355

Custom Control Design Patterns 357

Aggregate Container Pattern 357

Layout Container Pattern 358

Conclusion 365

Chapter 11 Advanced Scripting 367

Application Frameworks 367

AJAX and Partial Refresh 369

Partial Refresh: Out-of-the-Box Style! 369

Partial Refresh: Doing-It-My-Way Style! 376

Event Parameters 384

Dojo Integration 386

dojoTheme and dojoParseOnLoad Properties 387

dojoModule Resource 388

dojoType and dojoAttributes Properties 389

Integrating Dojo Widgets and Extending the Dojo Class Path 390

Working with Traditional Notes/Domino Building Blocks 401

Working with @Functions, @Commands, and Formula Language 402

Working with Agents, In-Memory Documents, and Profile Documents 405

Managed Beans 412

Conclusion 419

Chapter 12 XPages Extensibility 421

How to Create a New User Interface Control 422

Example Component 423

Let’s Get Started 424

Create the Initial Application 424

Add Package Explorer to the Domino Designer Perspective 424

Add a Java Source Code Folder 426

Building a Component 428

Create a UI Component Extension Class 428

Create Tag Specificaton (.xsp-config) for the UI Component Extension 431

Create a Renderer and Register It in the Application Configuration (faces-config.xml) 434

Quick Test Application to Verify Everything Is OK So Far 437

Working with Component Properties 438

Component Properties and Attributes 438

Adding a Property to a Component 439

State Holder: Saving State Between Requests 440

Specifying Simple Properties 440

Inheriting xsp-config Properties 441

Create the Initial xsp-config Definitions 446

Create base.xsp-config 446

Create an Interface to Match the Group Property Definition in base.xsp-config 450

Revisit the Component Properties in Domino Designer 452

Specifying Complex Properties 453

Complete the xsp-config for the UISpinner Component 464

Complete the UI Component Extension, UISpinner 473

Complete the Renderer UISpinnerRenderer 477

Create a Sample Application Using the UISpinner Component 483

Take Your New UI Component Extension for a Test Drive 483

Create a Backing Bean 483

Register the Backing Bean 486

Create the Final Test Application 486

Nice Look and Feel 491

Test to Ensure That It All Works! 491

Where to Go From Here 491

XPages Extensibility API Developers Guide 492

XPages Extension Library 492

IBM developerWorks 492

Conclusion 493

Chapter 13 XPages in the Notes Client 495

Think Inside the Box 496

Getting Started with XPages in the Notes Client 498

3, 2, 1...Lift Off 499

Bookmarks 501

Working Offline 503

One of These Things Is Not Like the Other 507

Other Subtle Differences 508

XPages: A Good Notes Citizen 511

Introducing enableModifiedFlag and disableModifiedFlag 513

Keeping Tabs on Your Client Apps 516

Notes Links Versus Domino Links 520

Some Debugging Tips 525

XPages and Composite Applications 528

Making a Component of an XPages Application 529

Is Anyone Out There? Creating a Component that Listens to Your XPages Component 531

Assembling a Composite Application: Aggregating the XPages Discussion Component and Notes Google Widget 533

Hey, This Is a Two-Way Street! A Component May Receive and Publish Events! 536

Further Adventures with Composite Applications 540

Part V: Application User Experience 541

Chapter 14 XPages Theming 543

It Used to Be Like That...But Not Anymore! 543

Styling with Style! 545

Setting the Style Property Manually 550

Understanding How the Style Property Is Used 551

Computing the Style Property 552

Styling with Class! 552

Getting Something for Nothing! 553

Understanding How the styleClass Property Is Used 559

Computing the styleClass Property 561

Working with Extended styleClass and style Properties 563

Theming on Steroids! 567

What Is a Theme? 567

What Can You Do with a Theme? 568

Understanding Theme Architecture and Inheritance 569

Working with a Theme 576

Theme Resources 587

Resource Paths 597

Theme Properties, themeId, Control Definitions, and Control Properties 606

Conclusion 620

Chapter 15 Internationalization 621

Using Localization Options 622

Localization with Resource Bundle Files 623

Setting Localization Options 624

Testing a Localized Application 626

Working with Translators 628

Merging XPage Changes 631

Gotchas! 633

Localizing Computed Expressions and JavaScript 636

Adding a Resource Bundle 637

Localizing Computed Expressions 638

Localizing Client-Side JavaScript 639

Localizing Script Libraries 640

Server-Side Script Libraries 640

Client-Side Script Libraries 641

International Enablement 643

Locales in XPages 644

Deprecated Locale Codes 648

Conclusion 650

Part VI: Performance, Scalability, and Security 651

Chapter 16 Application Performance and Scalability 653

Golden Rules 654

Understanding the Request Processing Lifecycle 655

GET-Based Requests and the JSF Lifecycle 656

POST-Based Requests and the JSF Lifecycle 656

Reducing CPU Utilization 658

GET- Versus POST-Based Requests 658

Partial Refresh 663

Partial Execution Mode 665

Reducing Memory Utilization 668

HTTPJVMMaxHeapSize and HTTPJVMMaxHeapSizeSet Parameters 669

xsp.persistence.* Properties 669

dataCache Property 670

Conclusion 672

Chapter 17 Security 673

Notes/Domino Security and XPages 673

Server Layer of Security 674

Application Layer of Security 675

Design Element Layer of Security 677

Document Layer of Security 684

Workstation ECL Layer of Security 686

Useful Resources 687

Let’s Get Started 687

Creating the Initial Application 687

Implementing ACLs 689

Sign the XPages with Your Signature 690

Programmability Restrictions 691

Sign or Run Unrestricted Methods and Operations 692

Sign Agents to Run on Behalf of Someone Else 692

Sign Agents or XPages to Run on Behalf of the Invoker 693

Sign Script Libraries to Run on Behalf of Someone Else 693

Restricted Operation 693

XPages Security Checking 695

NSF ClassLoader Bridge 695

XPages Security in the Notes Client 696

Execution Control List (ECL) 697

Active Content Filtering 699

Public Access 702

Setting Public Access for XPages 703

Checking for Public Access in XPages 703

SessionAsSigner 704

Troubleshooting XPages Java Security Exceptions 706

Conclusion 707

Part VII: Appendixes 709

Appendix A XSP Programming Reference 711

XSP Tag Reference 711

XSP Java Classes 712

Notes/Domino Java API Classes 714

XSP JavaScript Pseudo Classes 715

Appendix B XSP Style Class Reference 719

XSP CSS Files 719

XSP Style Classes 720

Appendix C Useful XPages Sites on the Net 727

Index 729

The authors of this book have a number of things in common. All three hail from Ireland, work for the IBM Ireland software lab, and have made significant contributions to the development of XPages over the past number of years.

Martin Donnelly is a software architect and tech lead for the XPages runtime team in IBM Ireland and has worked on all three XPages releases from Notes/Domino 8.5 through 8.5.2. Prior to this, Martin also worked on XFaces for Lotus Component Designer and on JSF tooling for Rational Application Developer. In the 1990s while living and working in Massachusetts, he was a lead developer on Domino Designer. Now once again based in Ireland, Martin lives in Cork with his wife Aileen, daughters Alison, Aisling, and Maeve, and retired greyhounds Evie and Chelsea. Outside of work, he confesses to playing soccer on a weekly basis and salmon angling during the summer when the opportunity presents itself.

Mark Wallace is a software architect working in the IBM Ireland software lab. In the past, he worked on the XSP runtime, which was developed for Lotus Component Designer and subsequently evolved into the XPages runtime. He has a keen interest in programming models and improving developer productivity. Mark has worked in Lotus and IBM for more than 15 years on various products and is currently working on Sametime Unified Telephony. Mark lives in Dublin with his wife and two children and spends as much time as possible in the Ireland’s sunny south east enjoying fishing and kayaking with his family.

Tony McGuckin is a senior software engineer in the IBM Ireland software lab. Having studied software engineering at the University of Ulster, he began his career with IBM in 2006 working in software product development on the component designer runtime before moving into the XPages core runtime team. When not directly contributing to the core runtime, Tony is busy with software research and development for the next generation of application development tooling, and also engaging directly with IBM customers as an XPages consultant. Tony enjoys spending time with his wife and daughter, and getting out into the great outdoors for hill walking and the occasional chance to do some hunting in the surrounding hillsides of his native County Derry.