Back Forward CDK Home Reference Samples Resources
JSB FAQ

 JavaScript Beans FAQ:

What is a JavaScript Bean (JSB)?

JavaScript Beans are components, similar to JavaBeans, created from JavaScript and potentially including HTML and Java. A JavaScript Bean provides a convenient mechanism for encapsulating the Dynamic HTML and JavaScript.

Most importantly, JavaScript Beans are re-usable components that can be imported directly into visual tools like Visual JavaScript where they can be linked together to build a web page that runs on every web browser that supports JavaScript. There is no need for "JavaScript Bean support" in the Browser, the end result of using a JSB in a tool like Visual JavaScript is a standard HTML page.

What benefits do JavaScript Beans provide to content developers and Web programmers?

JavaScript Beans provide a convenient mechanism for content developers to reuse HTML JavaScript. Instead of having to cut, paste, and modify code by hand, JavaScript Beans can be written once, using the HTML and JavaScript -- following simple conventions to expose well-defined interfaces. Robust JavaScript Beans feel just like JavaBeans, and can have icons, associated documentation and images, which can all be included in a single archive file for others to use.

Once the JavaScript Bean is imported into a tool like Visual JavaScript, users can quickly reuse the JavaScript Bean by dragging and dropping it to other Web pages from the Component Palette. Other authors can customize the behavior of the existing JavaScript Bean using visual Inspection tools or an optional Customizer (see CustomJSB for an example), without having to understand implementation details.

Using JavaScript Beans in web pages can provide high levels of interactivity without lengthy performance delays. JavaScript Beans can be composed of just HTML and script, and can be used to build web pages that are very lightweight and fast to download open in the browser. Once the JavaScript Bean is downloaded, it is stored in the cache for future use.

Where are JavaScript Beans supported?

JavaScript Beans are truly Cross-Platform -- and can be used to build web pages which are viewable on any JavaScript enabled browser, on Unix, Macintosh, Windows, or other platforms.

Does Microsoft Internet Explorer support JavaScript Beans?

Yes. Although JavaScript Beans that use advanced JavaScript functionality like layers and security will need to do browser detection at run-time to provide a simplified version of the full behavior to work around the limitations in Microsoft's support for JavaScript and Dynamic HTML.

How do JavaScript Beans relate to Dynamic HTML?

JavaScript Beans are a powerful way to encapsulate Dynamic HTML. Web developers can create powerful interactive JavaScript Beans -- many JavaScript Beans make use of Dynamic HTML (see DialogWidget JavaScript Bean for an example of a JavaScript Bean that opens a movable dialog window that can contain arbitrary HTML).

How does one turn JavaScript code into a JavaScript Bean?

There is a small amount of additional code to write, in an HTML-like format, to declare the public properties, methods and events for the JavaScript code. For a quick start, see the HelloWorld JavaScript Bean.

What ways should I use JavaScript Beans, JavaBeans and CORBA objects on my Web page?

Depending on what a Web Developer is trying to accomplish, they should try to use the best tool for the job:

  • JavaScript Beans are the fastest, easiest way to develop reusable Web Components. By creating a JavaScript Bean, the entire population of HTML and JavaScript Web Developers can use their existing knowledge and skills to create re-usable components, without having to learn new technologies. JavaScript Beans are essentially ways of describing HTML and JavaScript, they can download and run much faster than any other type of component, and are secure since they inherit the complete HTML / JavaScript Security Framework. Unlike Microsoft's ActiveX controls and scriptlets, JavaScript Beans are supported across browsers..
  • Java Beans provide a powerful, cross-platfrom language with rich functionality for drawing custom graphics and performing advanced operations quickly. JavaBeans can also be called from JavaScript Beans, making it possible to extend JavaBeans with JavaScript methods and properties. JavaScript Beans, based on HTML and JavaScript, are Universal Containers whereas JavaBeans are simply another type of content that can be placed in a container.
  • CORBA Beans allow for access to legacy systems and CORBA objects. Simply importing an IDL file into a tool like Visual JavaScript actually creates a JavaScript Bean (after all, JavaScript Beans are Universal Containers) that allows other components on the web page to access the services provided by the CORBA object associated with the IDL file.

What security risks are associated with JavaScript Beans?

JavaScript Beans are based on the strict security infrastructure provided by Netscape's implementation of JavaScript and Java. They are as safe as HTML and JavaScript when viewed in a secure browser like Netscape Navigator or Communicator.

Does Netscape support JavaScript Beans in any currently-shipping tools?

Yes. Today, Netscape provides a host of tools, including:

  • Visual JavaScript: for assembling web pages from JavaScript Beans
  • JSBeanBuilder: Provides a graphical JavaScript Bean creation environment and colorized editor.
  • JSBDoc: a sample / tool included in the CDK to help users build well-structured code by automatically generating documentation for JavaScript Beans (from their source code) in a manner similar to the JavaDoc tool for JavaBeans.

All of these tools are available today.

Are there other tool vendors supporting JavaScript Beans?

Yes. Vendor support includes companies like Acadia Software. For more information, go to the Acadia Web site at http://www.acadians.com/jsbeans.


( return to the top of the page )