开发者

using Struts Action design question

开发者 https://www.devze.com 2023-02-09 03:08 出处:网络
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 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消