Show TOC

JSPDynPage Event HandlingLocate this document in the navigation structure

Use

Some HTML-Business for Java controls have an event attribute (for example, see button). The button for example has an 'onClick' attribute that specifies the name of the method which should handle the event. The event will occur when the appropriate user action takes place - in this case clicks on the button. The name of the method specified with the 'onClick' attribute has to be declared in the JSP DynPage.

HTML-Business for Java: Statement to specify the method name:

Button1.setOnClick("myClick");

JSP DynPage: Declaration of the method that processes the event:

public void myClick (Event event) { ..coding.. }

or

public void onMyClick (Event event) { ..coding.. }

Both declarations are valid. The decision to use the on... method declaration could be helpful to make it obvious that this method handles an event.

Note

With the on.. declaration method the first letter of the declared event name must be a capital letter.

If both methods are implemented (myClick and onMyClick), only the method myClick, will be called. The method onMyClick will be ignored.

Note

Some HTML-Business for Java controls have a 'setOnClient' attribute. With this attribute you specify a JavaScript fragment that handles the event on the Web client side. The event is NOT transmitted to the Web server.

If an event occurs it is handled as follows (doInitialization is performed when the application starts).

  • doProcessAfterInput

    Called when the web client sends the form to the web server.

  • onMyClick

    The event handling method we declared.

  • doProcessBeforeOutput

    Called before the form is sent to the web client.

Event Processing