using Struts Action design question
I'm using Struts 1. I have an Action, and when this Action forwards to a page, I want the page to display properties from a bean. I'm thinking the Action will make the bean, it needs to populate info from a DB. Should I have the Action make the 开发者_如何学JAVAbean directly (in the execute()), or use some other class to make the bean, like a factory?
it depends where the data is coming from. Typically this is a database. I have always created services to do the data lookups, and invoked the services from the actions. The services invoked DAOs (data access objects). The services return objects/beans that are used in the jsps.
精彩评论