gpt4 book ai didi

jsp - JSF 标记如何影响 JSP 生命周期方法? JSP 和facelets 呢?

转载 作者:行者123 更新时间:2023-12-02 08:42:28 26 4
gpt4 key购买 nike

在 JSP 页面中使用 JSF 标记时,JSP 生命周期方法是否运行?如果有,顺序是什么?

使用 facelet 时 JSP 生命周期方法是否运行?

最佳答案

关于这个主题有一篇非常清晰的文章 in IBM's DeveloperWorks .关于在 JSF 应用程序中使用 JSP 的主题,它说明如下:

The body of the JSP becomes the equivalent of a servlet's doGet() and doPost() methods (that is, it becomes the jspService() method). The JSF custom tags (such as f:view and h:form) are just calls to the JSF components to render themselves in their current state. The life cycle of the JSF component model is independent from the life cycle of the JSP-produced servlet.

因此,您的第一个问题的答案是肯定的; JSP 页面遵循自己的生命周期,JSF 组件遵循自己的生命周期。在 Facelets 上,您还可以找到:

Unlike JSP, Facelets is a templating language built from the ground up with the JSF component life cycle in mind. With Facelets, you produce templates that build a component tree, not a servlet.

有了它,如果您已经在使用 Facelets,就没有必要将 JSP 与 JSF 一起使用。所以你的第二个问题的答案是否定的,因为根本没有 JSP 页面。

关于jsp - JSF 标记如何影响 JSP 生命周期方法? JSP 和facelets 呢?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15344927/

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