简体   繁体   English

是不赞成使用faces-config.xml还是JSF 2.0不需要?

[英]is faces-config.xml deprecated or required for JSF 2.0?

Going by the docs , it looks like faces-config.xml is required. 通过文档 ,看起来像faces-config.xml是必需的。 However, I thought, for some reason, that Facelets used annotations and so no xml config was required(?). 但是,由于某种原因,我认为Facelets使用了注释,因此不需要xml配置(?)。 They say: 他们说:

To configure JavaServer Faces to use Facelets as the ViewHandler, modify your project's faces-config.xml to specify the element 要将JavaServer Faces配置为使用Facelets作为ViewHandler,请修改项目的faces-config.xml以指定元素

It seems like Facelets tutorials are often dead links, or, like above, will soon be dead links :( 似乎Facelets教程通常是死链接,或者像上面一样,很快就会死链接:(

The "docs" which you linked in the question concerns Facelets 1.x, not Facelets 2.x which is included in JSF 2.0. 您在问题中链接的“docs”涉及Facelets 1.x,而不是JSF 2.0中包含的Facelets 2.x. You should not read Facelets 1.x tutorials to learn Facelets/JSF 2.x. 你不应该阅读Facelets 1.x教程来学习Facelets / JSF 2.x. Refer the Java EE 6 tutorial for the official Facelets 2.x tutorial and JSF 2.x tutorial . 请参阅Java EE 6教程以获取官方Facelets 2.x教程JSF 2.x教程

As to the annotations, they are not Facelets specific, they are JSF 2.x specific. 至于注释,它们不是特定于Facelets的,它们是JSF 2.x特定的。

As to the dead links: some months ago *.dev.java.net sites have been migrated to *.java.net sites but the site admins made a disaster of it; 至于死链接:几个月前* .dev.java.net网站已迁移到* .java.net网站,但网站管理员对此造成了灾难; the old URLs are not redirected, so the web remains with dead links. 旧的URL未被重定向,因此Web仍然具有死链接。 If you see a *.dev.java.net link, you need to remove the dev subdomain (and replace https scheme by http if necessary). 如果您看到* .dev.java.net链接,则需要删除dev子域(如果需要,请用http替换https方案)。

As to the question in the title: it's definitely not deprecated. 关于标题中的问题:它绝对不会被弃用。 It's still required. 它仍然是必需的。 Bozho already pointed out the facts. Bozho已经指出了事实。

Faces-config.xml is still there for some global configurations, but most of it can be omitted if annotations are used. Faces-config.xml仍然适用于某些全局配置,但如果使用注释,则大多数配置都可以省略。 As for Facelets, they are now the default view technology in JSF. 至于Facelets,它们现在是JSF中的默认视图技术。 No need to configure or include anything. 无需配置或包含任何内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM