Html 什么 jsf 组件可以渲染 div 标签?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/951593/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What jsf component can render a div tag?
提问by user101442
Eg: h:inputText
will render a "input type='text'"
.
What jsf tag can render a "div"
tag?
例如:h:inputText
将呈现一个"input type='text'"
. 什么 jsf 标签可以渲染"div"
标签?
回答by Romain Linsolas
You can create a DIV
component using the <h:panelGroup/>
.
By default, the <h:panelGroup/>
will generate a SPAN in the HTML code.
您可以DIV
使用<h:panelGroup/>
. 默认情况下,<h:panelGroup/>
将在 HTML 代码中生成 SPAN。
However, if you specify layout="block"
, then the component will be a DIV
in the generated HTML code.
但是,如果您指定layout="block"
,则组件将是DIV
生成的 HTML 代码中的 。
<h:panelGroup layout="block"/>
回答by mp31415
In JSF 2.2 it's possible to use passthroughelements:
在 JSF 2.2 中,可以使用passthrough元素:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:jsf="http://xmlns.jcp.org/jsf">
...
<div jsf:id="id1" />
...
</html>
The requirement is to have at least one attribute in the element using jsf namespace.
要求是使用 jsf 命名空间的元素中至少有一个属性。
回答by Nick Grubb
Apart from the <h:panelGroup>
component (which comes as a bit of a surprise to me), you could use a <f:verbatim>
tag with the escape parameter set to false
to generate any mark-up you want. For example:
除了<h:panelGroup>
组件(这让我有点惊讶),您可以使用<f:verbatim>
带有转义参数设置为的标签false
来生成您想要的任何标记。例如:
<f:verbatim escape="true">
<div id="blah"></div>
</f:verbatim>
Bear in mind it's a little less elegant than the panelGroup
solution, as you have to generate this for both the start and end tags if you want to wrap any of your JSF code with the div
tag.
请记住,它不如panelGroup
解决方案优雅,因为如果您想用div
标记包装任何 JSF 代码,您必须为开始和结束标记生成它。
Alternatively, all the major UI Frameworks have a div
component tag, or you could write your own.
或者,所有主要的 UI 框架都有一个div
组件标签,或者您可以编写自己的标签。
回答by Hyman jin
you can use myfaces tomahawk component
你可以使用 myfaces tomahawk 组件
http://myfaces.apache.org/tomahawk-project/tomahawk12/tagdoc/t_div.html
http://myfaces.apache.org/tomahawk-project/tomahawk12/tagdoc/t_div.html
回答by Sanket
I think we can you use verbatim tag, as in this tag we use any of the HTML tags
我想我们可以使用逐字标记,因为在这个标记中我们使用任何 HTML 标记