BBjspCommandResult::setForward (Deprecated)

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

Description

In BBj 16.0 and higher this method sets the forward name for this BBjspCommandResult.

Syntax

Return Value

Method

void

setForward(string forward)

Parameters

Variable

Description

forward

the forward name

Return Value

None.

Remarks

The forward name must be defined in the command configuration file.

Example

class public LogonCommand

    field public BBjspWebRequest request!
    field public BBjspWebResponse response!
    field public BBjspWebSession session!

    method public BBjspCommandResult execute(BBjspCommandContext context!)

        declare BBjspCommandResult result!
        #request! = context!.getRequest()
        #response! = context!.getResponse()
        #session! = request!.getSession()

        result! = context!.getResult()
        result!.setForward("fail")

        action$ = Request!.getParameter("action")

        if ("logon" = action$) then
            username$ = Request!.getParameter("userName")
            password$ = Request!.getParameter("password")

            if (password$ = "admin123") then
                #session!.setAttribute("USER_NAME",username$)
                result!.setForward( "logon_success" )
            else
                result!.addError("logonForm","Incorrect Username or Password")
            endif
        endif

        if ("logoff" = action$) then
            #session!.invalidate()
            result!.setForward( "logoff_success" )
            result!.addMessage("logonForm","User logged-off")
        endif

        context!.getJettyContext().getLogger().log("LogonCommand : " + result!.getForward())

        methodret result!
    methodend

classend

See Also

BBJSP

BBjspCommand