BBjspPageContext::getSession (Deprecated)

The BBJSP system is deprecated. For new development, use BBxServlet.

Description

In BBj 16.0 and higher, this method returns the BBjspWebSession associated with the BBjspPageContext.

Syntax

Return Value

Method

BBjspWebSession

getSession()

Parameters

None.

Return Value

the BBjspWebSession associated with this request

Remarks

Although you can use this method to get the BBjspWebSession you should use the build-in field #Session! .

Example

This example demonstrates how this works in a BBJSP widget

REM ===
REM === A BBjspWidget that counts page-visits for the user.
REM ===

class public PageCounterWidget implements BBjspWidget

  method public void open(BBjspPageContext context!)

    context!.runPipelineByName("MyPipeline")
    
    request! = context!.getRequest()
    response! = context!.getResponse()
    session! = context!.getSession()
    data! = context!.getBBjspSession()

    ct = 0
    if data!.contains("VISIT_COUNT") then
      ct = num(data!.getAttribute("VISIT_COUNT"))
    endif
    ct = ct + 1
    data!.setAttribute("VISIT_COUNT",str(ct))
    
    context!.saveBBjspSession()
    
  methodend

classend

See Also

BBJSP

BBjspPageContext

BBjspWebSession