BBjspCommand::execute (Deprecated)

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

Description

In BBj 16.0 and higher, all implementations of the BBjspCommand should implement this method which is the main entry point for the command.

Syntax

Return Value

Method

BBjspCommandResult

execute(BBjspCommandContext context)

Parameters

Variable

Description

context

the BBjspCommandContext in which the command will be executed

Return Value

BBjspCommandResult

Remarks

None.

Example

REM === This is a basic BBJSP Command.
REM === It must implement the BBjspCommand interface and have the execute method.
REM ===
class public MyCommand implements BBjspCommang

  REM ===
  REM === This method is defined in the BBjspCommand interface
  REM ===
  
  method public BBjspCommandResult execute(BBjspCommandContext context!) 
    declare BBjspWebRequest request!
    declare BBjspWebResponse response!
    declare BBjspSessionData data!
    declare BBjJettyContext jettyContext!
    declare BBjspLogger logger!
    request! = context!.getRequest()
    response! = context!.getResponse()
    data! = context!.getBBjspSession()
    jettyContext! = context!.getJettyContext()
    logger! = context!.getLogger()
    
    logger!.log("Executing 'MyCommand'")
    REM === Get a BBjspCommandResult from the BBjspCommand Context   
    result! = context!.getResult()
    REM ===
    REM === INSERT BUSINESS LOGIC
    REM ===
    REM === Set the outcome policy to 'success'
    result!.setForward("success")
    REM === Save any changes to the BB
    context!.saveBBjspSession()
    jettyContext!.getLogger().log("Completed execution of MyCommand in context "+context!.getContextName())
    methodret result!
  methodend
  
classend

See Also

BBJSP

BBjspCommandContext