What Does Struts Offer for the Model?
To be honest, the Struts framework doesn’t offer much in the way of building model components, but this probably is as it should be. Many frameworks and component models are already available for dealing with the business domain of an application, including Enterprise JavaBeans and Java Data Objects (JDO), or you can use regular JavaBeans and an ORM. The good news is that the Struts framework does not limit you to one particular model implementation. This chapter will present one approach. In Chapter 13, we’ll take a completely different approach and see how the framework is affected by this change.
Building the Storefront Model
After all this discussion of what constitutes a model for a Struts application, it’s finally time to apply the previously discussed concepts using the Storefront application as the business domain. Obviously, the Storefront is a fictitious example and doesn’t represent a complete model for what a “real” e-commerce application would need to support. However, it does provide enough of an object model for you to understand the semantics of this chapter.
Accessing a Relational Database
The state of the Storefront application will be persisted using a relational database. This is, in fact, how it would be done if Storefront were a real application. Of course, an ERP system often is used in conjunction with the relational database, but many e-commerce applications use a relational database closer to the frontend for performance ...
Get Programming Jakarta Struts, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.