JSF несколько отступающих бобов на одной странице

Поля класса являются нулем по умолчанию. Это документируется так, можно полагаться на него. Локальный стек varaiables не определен, если строка или интерфейс, они не обнуляются.

6
задан Nir Levy 10 December 2009 в 19:41
поделиться

2 ответа

Let's clarify some terms:

  • managed beans are JavaBeans components that you can configure using the managed bean facility see
  • backing beans, are a JavaServer Faces managed beans that are associated with the UI components used in a particular page see

So, yes you can use two or more managed beans in a single JSF page, but splitting UI components bindings, listeners, logic etc. that are related to one page into two or more backing beans is still posible but very undesirable and might cause you lot of problems and bad code.

4
ответ дан 16 December 2019 в 21:41
поделиться

Why not? It's a perfectly legitimate thing to do. Generally, a page should be associated with one bean (for the sake of good structure), but if you want, for example, to show the current time on each page, you are free to reference your timeBean.currentTime, among other things (of course, using include/templating is preferable here).

3
ответ дан 16 December 2019 в 21:41
поделиться
Другие вопросы по тегам:

Похожие вопросы: