jsf隐式对象cc和组件之间的区别
也许这是一个愚蠢的问题,但我用来
cc
指复合组件,例如 cc.attrs.randomAttr 但我也看到了
component
隐式对象并且我使用了它,因为我被告知要这样做,但我真的不明白什么它是为了。谁能解释一下吗?
Maybe this is a dumb question, but I use
cc
to refer to the composite component, for instance cc.attrs.randomAttr but I have also seen the
component
implicit object and I have used it because I was told to but I don't really understand what it is for. Can anyone explain please?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
cc
指的是评估时正在处理的顶级复合组件。component
只是正在处理的 ui 组件。因此,在复合组件内部时,
cc
指的是“父”组件,而在单个组件上使用时,component
指的是该特定实例。或者对于简单情况:cc
==component.getCompositeComponentParent(component)
,其中组件是构建复合组件的组件。例如,考虑以下复合组件:
在 Facelet 上使用此组件将打印 2 个不同的“自己的”ID,即两个 outputText 组件的 ID,而两行上的复合 ID 将相同。
请注意,当涉及复合组件的多个嵌套时,事情可能会变得更加复杂。
cc
refers to the top level composite component that is being processed at the time of evaluation.component
simply is the ui component being processed.So when inside a composite component,
cc
refers to the 'parent' component, whilecomponent
when used on an individual component refers to that particular instance. Or for simple cases:cc
==component.getCompositeComponentParent(component)
, with component being a component of which the composite component is build.E.g. consider the following composite component:
Using this on a Facelet will print 2 different "own" IDs, namely the ones of the two outputText components, while the composite ID will be the same on both lines.
Note that things may become a little more complicated when multiple nestings of composite components are involved.