JSP Tag Libraries

Скачать в pdf «JSP Tag Libraries»


ce.getPriceDollars() + «.» + ce.getPriceCents());


}


}


CHAPTER 12


Custom tags and J2EE


B References the EJB using the JNDI registry Obtains a reference to the home object through the JNDI registry. The container signs up the EJB home (container-generated) implementation in the JNDI registry. The EJB’s user references this home by resolving its name from the JNDI registry.


e Narrows the returned home to the actual class Casts the home reference into the correct home class. The process of casting the home from a remote reference as retrieved from the JNDI registry to a real object may differ from one remote method call implementation to another, so the client uses the class javax .rmi.Por-tabieRemoteObject to perform the protocol and platform-specific casting.


D Uses a single EJB by its primary key О Lists all the books by finding based on the type attribute Uses one of the finder (or create) methods to reference an EJB instance and then calls any desired instance methods. Note that when the finder method returns more than a single result, it will return all these results within a Collection object that the client iterates through to fetch returned EJBs.


Overall, and considering what we managed to achieve (locating a remote object and calling methods that actually go to a database), the complexity price is not that high. In the code samples in this section, we created a program that accesses a database and searches for specific table entries within that database with very little fuss. This showcases some of the advantages of EJB technology.

Скачать в pdf «JSP Tag Libraries»