BBjspWebSession::isNew


Description

In BBj 16.0 and higher, this method returns true if the client does not yet know about the session or if the client chooses not to join the session.

Syntax

Return Value

Method

boolean

isNew()

Parameters

None.

Return Value

a boolean where 0=not new and 1=new.

Remarks

The example below shows testing to see if the session is new in a BBJSP BBJSP Servlet.

Example

This example demonstrates how this works in a BBJSP web-page

<%@ taglib uri='/WEB-CFG/tld/core.tld' prefix='c' %>
<html>
    <body>
        <h1>Hello from BBJSP</h1>")
        <c:if test='<%= #gerSession().isNew() %>' >
            SESSION IS NEW
        </c:if>
    </body>
</html>

This example demonstrates how this works in a BBJSP servlet

class public MyServlet

  field private BBjspWebRequest request!
  field private BBjspWebResponse response!
  field private BBjspWebSession session!
  
  method public void service(BBjspServletContext context!)
       
    #request! = context!.getRequest()
    #response! = context!.getResponse()

    #session! = #request!.getSession()
    s! = #response!.getOutputStream()
    
    #response!.setContentType("text/html")
    
    s!.write("<html><body><h1>Hello from BBJSP</h1>")
    if #session!.isNew()
      s!.write("NEW SESSION")
    endif
    s!.write("</body></html>")
  methodend
classend

See Also

BBjspWebSession