Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

Share this Page URL
Help

Chapter 8. Java Beans > Server-Side Java Beans - Pg. 215

Java Beans { // tell the catcher to catch my pitch catcher.catchPitch(newPitch); } } 215 So, in the end, we have three networked components talking to one another using the Java Beans infrastructure, as shown in Figure 8-6. Figure 8-6. Component interaction is simple using the Java Beans infrastracture. Bean Introspection As we have mentioned, introspection is the ability of your Bean to be probed from another outside, or introspecting, class. The introspecting class surveys the contents of your Bean and keeps track of what services are available within it. After introspecting a Bean, the outside class can then go about creating its own methods to interface with your Bean. Typically, introspection will occur on behalf of object builders that will know nothing about the implementation of a Bean, only being able to survey its internals. These GUI builders could have a suite of Beans already existing locally. It can then allow you to create your own Bean by tying in the functionality of other Beans. This can be displayed graphically. GUI builders that take full advantage of Beans introspection will soon be available. In addition, the Bean Developer's Kit will include all the tools and Java classes necessary to develop your own Beans and Beans-based applications. Server-Side Java Beans Server-side Java Beans are Beans that, rather than being part of the client, live out their lifecycle on the server. Newer server-side technologies like Servlets and Java Server Pages are users of server-side Java Beans. On the server side, Beans can be simpler than on the client side because they typically don't have a visual component nor must they be placed in a JAR file. They can just be used as a compiled Java class, which in itself makes them simpler to use than the client-side Beans. As promised in the section on JSP in the Web server chapter, the following is the Appointments Bean developed for the featured Internet calendar application. As you look over the code, you'll notice that it looks more than vaguely familiar. It is essentially the same code from the code used previously for the JDBC, RMI, and servlet implementations of the calendar application; it is just packaged a little differently.