1
votes

I am basically trying to understand xsp properties for XPages. I have referred multiple websites and found a small problem to understand the xsp.session.transient property.

This Blog( http://www.mindoo.com/web/blog.nsf/dx/17.07.2011101855KLEBRW.htm?opendocument&comments) states that:

"this flag means that unique session objects will be created per request to the server and discarded right after the request ended"

When I look into this blog (http://www.itwu-demo.net/web/itwublog.nsf/default.xsp?documentId=E42CD391498BDE9CC1257A770040B2EB) it says that setting it to true may result in loss of objects. I observed this side effect when I used tabbed navigation on my page. The code mentioned below would just refresh for the second hierarchical tab and would never go to the third hierarchy. If I set the property to false it works well. However, I would like to understand the reason of this behavior? Also, how exactly the property could be used for our benefit? Can anyone please throw some light here. Thanks.

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">

    <xp:tabbedPanel id="tabbedPanel1">
        <xp:tabPanel label="New Tab" id="tabPanel1">a</xp:tabPanel>
        <xp:tabPanel label="New Tab2" id="tabPanel2">b<xp:br></xp:br>
            <xp:tabbedPanel id="tabbedPanel2">
                <xp:tabPanel label="New Tab" id="tabPanel3">c</xp:tabPanel>
                <xp:tabPanel label="New Tab2" id="tabPanel4">d<xp:br></xp:br>
                    <xp:tabbedPanel id="tabbedPanel3">
                        <xp:tabPanel label="New Tab" id="tabPanel5">e</xp:tabPanel>
                        <xp:tabPanel label="New Tab2" id="tabPanel6">f</xp:tabPanel>
                    </xp:tabbedPanel>
                </xp:tabPanel>
            </xp:tabbedPanel>
        </xp:tabPanel>
    </xp:tabbedPanel>
</xp:view>
1

1 Answers

1
votes

The xsp.session.transient property is documented in the XPages Portable Command Guide book.

The following is a summary of the property taken from the book:

By default, the XPages runtime is a stateful web application framework. A request for an XPage results in a degree of server-side processing that begins with creation or retrieval of a user session and ultimately ends with a rendering process that builds up the content for a response. During this server-side processing, a user session configuration object, along with all the controls on a requested XPage, have their respective properties and values serialized to disk and/or deserialized from disk. This is due to the inbuilt serialization mechanism of XPages that manages and provides the stateful characteristics of the XPages runtime. Based on application requirements, it might be beneficial from a performance and scalability perspective for an application not to participate in this serialization process, to optimize its level of participation. This aim of the xsp.session.transient property is to provide a way to control how user session objects are serialized between requests.

By default, the XPages runtime sets this property to false. Therefore, the serialization process includes all user session objects, but not the sessionScope object. This means that any XPages a given user requests are serialized/deserialized in association with the user session object over the life of that user session object. They are discarded along with the user session object when the overall user session timeout duration passes.

Alternatively, if this property is set to true, the XPages runtime automatically avoids serializing user session objects between XPage requests. It is important to note that a user session object still is instantiated for a request, but it simply is not serialized between requests. This also means that properties and values of controls within requested XPages still participate in the serialization process—this ensures that an XPage can still provide a rich user experience for the scoped variables and partial execution of actions, for example. However, when a user navigates to another XPage, the associated stateful data for that XPage is discarded because the user session object is not serialized between requests. This feature is made available for use cases that require an extremely optimal level of performance tuning where server memory must be finely managed. Note that such use cases are those in which partial updates are applied against only the current page; full page refreshes cause the state to be discarded between requests. Therefore, the design and intent of the page require careful consideration to benefit from this feature.


As you read from the documentation, the state of objects are not kept between requests if xsp.session.transient is set to true.

I can highly recommend buying the XPages Portable Command Guide.