Jsf How to create a Naming Container

后端 未结 2 1291
小蘑菇
小蘑菇 2020-12-14 13:00

I have a problem with duplicated ids in my JSF app. I\'ve read in this post that one of the possible solutions is to use Naming Container. Can you give me some example how t

2条回答
  •  情歌与酒
    2020-12-14 13:33

    I suggest to take a step back and investigate why the duplicate ID problem occurs. Once you nailed the root cause down, then just fix it the "usual" way rather than creating your own UINamingContainer component.

    There are several possible causes for duplicate ID errors which should help you further nailing it down:

    • The same ID is used on different UIComponents inside the same UINamingContainer component.
    • Physically different components are bound to the same UIComponent property of the same bean.
    • JSP only: the f:subview is been declared in the parent page instead of the include page.
    • The same include page is included multiple times inside the same UINamingContainer component.
    • A component is been dynamically built (e.g. new UIComponent()) without having an ID assigned.

    Here, UINamingContainer is under each the , and .

    If the above suggestions doesn't help, then update your question to include the smallest possible code snippet (thus, without all irrelevant code/clutter like unrelated components, libraries, HTML/CSS/JS/etc) which reproduces the exact same problem by just copy'n'paste'n'running it without any changes.

提交回复
热议问题