gpt4 book ai didi

html - 为什么我们需要 in JSF

转载 作者:太空宇宙 更新时间:2023-11-04 16:22:44 25 4
gpt4 key购买 nike

<h:body>有什么特殊用途吗? ? <body>制作 JSF 应用程序时还不够吗?

最佳答案

来自 the documentation

This tag renders an HTML body element. It also provides a target for JSF resource relocation. This enables JSF developers to implement components that have dependencies on resources such as images, scripts, and cascading stylesheets in a more flexible way by telling the JSF framework where to render these resources at request time. The usual targets are the "head" or "body" tags. Relocatable resources are especially useful when implementing JSF2 composite components.

this

Render the starting element tag. Just before rendering the closing element tag, render any resources that have been targeted for this "body" element:

  • Obtain a UIViewRoot instance.
  • Obtain a List of component resources targeted for this "body" element with a call to UIViewRoot.getComponentResources() with the String "body" as the argument. Render the ending element tag.
  • Iterate over the returned List of UIComponent instances and call encodeAll on each UIComponent instance.

所以,我想关键在于提供 JSF 框架使用的资源。

第一句话说通常的目标是“head”或“body”标签。例如,如果在 <h:body>标签你有 <h:outputScript name="hello.js"/> , 这将在 <body> 中呈现脚本标签,但这可以更改为 <head>如果您在 target 中指定属性。这是资源重定位,可以找到更详细的解释 here .

关于html - 为什么我们需要 <h :body> in JSF,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27920356/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com