0

Hey guys. I'm designing a site that uses the Icefaces framework. I've been reading a book called Real World Java EE patterns. I'm kind of confused how to layout the pages. Normally I would have just a POJO class implement serializable for a bean. This bean would then back each page. With a single page design I'm going to have a bunch of elements on the page. Datatables, trees, inputs, calendars etc. Is it normal or best practice to have separate beans for each datatable, calendar, etc or put that all in one bean? I'm not sure how to approach this. Right now each element is a bean and I'm using the @Inject annotation to have the data table talk to the tree and vise versa. This creates really bad code and if I put this as a member of the class I will get a circular reference because the data table bean has to inject the calendar and the calendar has to inject the data table.

Thanks for any help.

4

1 回答 1

1

我倾向于每个<h:form>或至少每个视图(XHTML/JSP 文件)使用单个 bean。任何相关的 bean 都将被注入到这个特定的“主”bean 中(因此不会相互之间)。

于 2010-11-24T19:39:56.763 回答