JSF中的class和styleClass属性之间有什么区别? [英] What is the difference between class and styleClass attributes in JSF?
问题描述
我看到,在JSF中,大多数标准组件都映射到HTML标签,例如<h:commandButton/>
,具有属性class
和styleClass
.但是,无论我使用哪一个,都在标记中都呈现为class
属性.
I see, that in JSF most of the standard components that mapped to HTML tags, e.g. <h:commandButton/>
, have attributes class
and styleClass
. But no matter, which one I use, both is rendered as class
attributes in markup.
那么为什么有两个目的相同的属性?
So why there are two attributes with the same purpose?
推荐答案
JSF组件中根本没有class
属性.
There is simply no class
attribute in JSF components.
在文档中,属性为styleClass
:
呈现此元素时要应用的CSS样式类的以空格分隔的列表.此值必须作为生成的标记的类"属性传递.
Space-separated list of CSS style class(es) to be applied when this element is rendered. This value must be passed through as the "class" attribute on generated markup.
styleClass
只是在呈现的HTML中转换为class
.
The styleClass
is simply converted as class
in the rendered HTML.
更多信息:
这篇关于JSF中的class和styleClass属性之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!