什么时候应该使用JSF组件,什么时候应该使用html标记? [英] When should I use JSF components and when should I use html tags?

查看:148
本文介绍了什么时候应该使用JSF组件,什么时候应该使用html标记?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用JSF设计一个网页。



我可以使用< h:panelGroup> < h:panelGrid> ,或者我可以使用< p> < div> 等。

感谢!

解决方案

如果您不需要JSF提供的功能标记,我宁愿使用纯HTML。
$ b 例如,< h:panelGroup> 有一个呈现属性,允许您绑定到一个支持bean布尔变量来有条件地显示输出,但是使用< div> < span> ; ,你不能这样做。


$ b $ << h:panelGroup> 将会默认情况下会生成一个< span> 。如果您喜欢< div> ,那么您可以使用< h:panelGroup layout =block> 。它会为你生成一个< div>


I would like to design a webpage using JSF.

Some parts of the page I can layout using <h:panelGroup> and <h:panelGrid> or, instead, I can use <p>, <div>, etc instead.

Just wondering which is preferable for best practices.

Thanks!

解决方案

If you don't need the features provided by the JSF tag, I'd prefer to use plain HTML.

For example, <h:panelGroup> has a rendered attribute that allows you bind to a backing bean boolean variable to conditionally display the output, but with a <div> or <span>, you cannot do this.

The <h:panelGroup> will by default generate a <span>. If you prefer a <div>, then you can use <h:panelGroup layout="block">. It will generate a <div>for you .

这篇关于什么时候应该使用JSF组件,什么时候应该使用html标记?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆