TROIKA.ASP - the MVC framework

HelloAction.js

Summary

Contains HelloAction class.

This is part of Troika.ASP Framework - web development MVC framework for ASP 3.0. Please visit www.troika-asp.com for more details.



Version: $Revision: 1.4 $

Author: Pavel Chuchev pav@troika-asp.com


Class Summary
HelloAction This is HelloAction class command implementation.

/**
* @fileoverview Contains <tt>HelloAction</tt> class.
*
* <p>
* This is part of Troika.ASP Framework - web development MVC framework for ASP 3.0.
* Please visit {@link http://www.troika-asp.com www.troika-asp.com} for more details.
* </p>
*
* @author Pavel Chuchev pav@troika-asp.com
* @version $Revision: 1.4 $
*/
HelloAction.prototype =  new Command();
HelloAction.prototype.constructor = HelloAction;
/**
* Initializes <tt>HelloAction</tt>.
*
* @param {Config} config The instance of <tt>Config</tt> class
* @return <tt>HelloAction</tt> object instance itself.
* @type HelloAction
*/
HelloAction.prototype.init = function (config) {

    Command.prototype.init.call(this, config);
    return this;
};

/**
* Constructs a new HelloAction class.
*
* @class This is <tt>HelloAction</tt> class command implementation.
*
* @constructor
* @base Command
* @param {Config} config The instance of Config class.
*/
function HelloAction(config) {

    if (arguments.length) {

        this.init(config);
    }
}
/**
* Performs business logic here. Checks to see if visitorName is supplied, forwards to error page otherwise.
*
* @base Command
* @param {Environment} environment The instance of <tt>Environment</tt> class.
* @param {HelloForm} helloForm The instance of <tt>HelloForm</tt> class- RequestContext.
* @return The instance of <tt>ResponseContext</tt> class
* @type ResponseContext
*/
HelloAction.prototype.execute = function (environment, helloForm) {

    var result =  new ResponseContext(this.findForward(helloForm, "success"));

    if (helloForm.visitorName.trim()) {

        result.models.put("now",  new Date().toString());
        Logger.log.info("Visitor name: " + helloForm.visitorName);
    }
    else {

        result.forward = this.findForward(helloForm, "action-error");
        result.errors.add(new Error("Name cannot be empty!"));
    }

    return result;
};

TROIKA.ASP - the MVC framework

www.troika-asp.com
Documentation generated on Sun Jun 15 17:59:32 2008