BBJSP Widget Overview (Deprecated)

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



In BBj 16.0 and higher, the BBJSP framework provides widgets that can be injected into a BBJSP Page. Consider a Widget as being similar to a Java Bean as it provides data through the BBjspPageContext that can be used in your pages.

Implementing your widget

Every BBJSP Widget must be implemented as a custom class as in the example below, implementing the following method.

METHOD PUBLIC void open(<a href="../BBjspPageContext/bbjsppagecontext.html">BBjspPageContext</a> context!)

Include the BBJSP Widget in your Page

To use a BBJSP Widget within a page or a custom tag you should first include the widget into the page with the <bbj:widget/> tag as follows:

<bbj:widget id='product' source="widgets/Product.bbj" class='ProductWidget' />

When the page is executed, the wiget's open(BBjspPageContext context!) method will be called to initialize the widget for use. All public fields will be available in the BBJSP Expression Language.


This is a simple widget with fields that are available to the BBJSP Expression Language including a BBjVector containing string entries.


rem '===
rem '=== A simple BBjspWidget that puts a BBjVector in the BBjspPageContext.
rem '===

class public SimpleWidget implements BBjspWidget

    field public BBjVector MyVector!
    field public BBjString Test$="Test Widget"

    method public void open(BBjspPageContext context!)
        #MyVector!.add("Hello World")
        #MyVector!.add("This in a Vector")


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

<%@ taglib uri='/WEB-CFG/tld/core.tld' prefix='c' %>
<bbj:widget id='myWidget' source='widgets/SimpleWidget.bbj' class='SimpleWidget' />
    <h1>Hello from BBJSP</h1>
      <c:iterate data='${myWidget["MyVector"]}' id="name">

See Also



BBJSP Widget