When an action class asks for an (Web hosting service) implementation

When an action class asks for an implementation of the service interface, the factory now creates a dynamic proxy that implements this interface using an instance of DynamicStorefrontEJBDelegate. When the action makes a call on the service interface, the call goes to the proxy and is transformed into a call on the delegate’s invoke( ) method. The invoke( )method checks the name of the method that was called and either calls the logout( )or destroy( )method implemented in the class or delegates it to the session-bean method with the same name. This sequence of calls is illustrated in Figure 13-1. The trapping and replacement of RemoteException when our business delegate calls a session-bean method are now handled in a single place. This single invoke( )method can handle all of the methods exposed by the session-bean business interface without modification. Figure 13-1. S equence diagram for retrieving item detail through a dynamic proxy A dynamic proxy is an appealing technique for minimizing method clutter in a business delegate, but there’s a price to pay. When considering an approach such as this that relies heavily on reflection, you need to weigh the slower runtime performance that will result against the improved maintainability of your code. 13.3 Conclusion Not all web applications require the sophistication and complexity of an EJB container. The well- documented benefits of using an EJB server must be evaluated seriously against the added development and management complications for each project. Don’t just assume that you have to use EJB for the model portion of a Struts application. However, if you do decide that EJB is appropriate, it doesn’t have to impact the rest of the code. There are approaches that you can take to limit the coupling of your application to EJB and make it much easier to use. Chapter 14. Using Tiles Up to this point, not much has been said about how to organize and assemble the content and layout of JSP pages for a Struts application. In many ways, that is outside the scope of the topic of Struts. Many excellent books are available that provide strategies for organizing web content and the layout of pages. In the Storefront application, we have used two different approaches to assembling web pages. The first approach, sometimes referred to as a straight JSP-based approach, is probably the most familiar to web designers. The JSP pages contain presentation logic along with HTML layout tags; there’s no separation of the two. This approach is typically used for smaller, less complicated web applications.
Please visit Domain Name Hosting services for high quality webhost to host and run your jsp applications.

Leave a Reply