JSF 1.1 后不推荐使用类型 API 变量解析器。使用 el-resolver 代替

发布于 2024-12-12 01:59:16 字数 1295 浏览 0 评论 0原文

我们最近从 WebSphere Portal v6.1 升级到 v7.0,在此过程中我们现在可以使用 JSF 1.2。在 Rad 8 中创建一个新的 Portlet 项目会创建一个包含以下条目的 faces-config.xml

<application>
    <state-manager>com.ibm.faces.application.DevelopmentStateManager</state-manager>
    <variable-resolver>com.ibm.faces.portlet.PortletVariableResolver</variable-resolver>
</application>

然后抱怨:类型 API 变量解析器在 JSF 1.1 后已被弃用。请改用 el-resolver。

不幸的是,我在 IBM 页面上找不到要使用哪个 el-resolver 的答案。

编辑:

System.out.println("Resolver: " + PortalUtil.getFacesContext().getApplication().getELResolver());

=>解析器:com.sun.faces.el.FacesCompositeELResolver@696e696e

在 faces-config 中添加条目

<el-resolver>com.sun.faces.el.FacesCompositeELResolver</el-resolver>

无论是否删除变量解析器都会导致:

java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.context.FacesContextFactory
    at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:270)
    at javax.faces.webapp.FacesServlet.init(FacesServlet.java:164)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:358)
    ... 89 more

IBM 打开的 PMR ...

We recently upgraded from WebSphere Portal v6.1 to v7.0 and in the process we now have JSF 1.2 available. Creating a new Portlet project in Rad 8 creates a faces-config.xml with the following entry

<application>
    <state-manager>com.ibm.faces.application.DevelopmentStateManager</state-manager>
    <variable-resolver>com.ibm.faces.portlet.PortletVariableResolver</variable-resolver>
</application>

And then complains: Type API variable-resolver is deprecated after JSF 1.1. Use el-resolver instead.

Unfortunately i could not find an answer on the IBM pages which el-resolver to use.

Edit:

System.out.println("Resolver: " + PortalUtil.getFacesContext().getApplication().getELResolver());

=> Resolver: com.sun.faces.el.FacesCompositeELResolver@696e696e

Adding an entry in faces-config

<el-resolver>com.sun.faces.el.FacesCompositeELResolver</el-resolver>

With or without removing the variable-resolver leads to:

java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.context.FacesContextFactory
    at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:270)
    at javax.faces.webapp.FacesServlet.init(FacesServlet.java:164)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:358)
    ... 89 more

PMR with IBM opened ...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

剧终人散尽 2024-12-19 01:59:16

IBM 对 PMR 的回应:

问 - 忽略警告可能会产生什么后果?

Ans - 用户仍然可以使用变量解析器,功能不会受到影响。 [此标签将保留以实现向后兼容性]

问 - 为什么生成的 faces-config.xml 仍然使用已弃用的方法?

Ans - 我们正在使用变量解析器来解析 portlet 变量,即使与 JSF 1.2 一起使用也能很好地工作

问 - 是否会有用于 portlet 的 el-resolver?

Ans - 将有一个用于 portlet 的 el-resolver。它将在 JSF portletbridge 2.0 中提供,该版本将作为 WAS 的更新提供。目前正处于规划阶段,因此我无法向您提供准确的版本。

IBMs response to the PMR:

Q - What might be the consequences of ignoring the warning?

Ans - User can still use variable resolver, the functionality will not be affected. [This tag will be maintained for backwards compatibility]

Q - Why does the generated faces-config.xml still use the deprecated method ?

Ans - We are using variable resolver to resolve the portlet variables, which would work well even with JSF 1.2

Q - Will there be or is there an el-resolver for portlets?

Ans - There will be an el-resolver for portlets. It will be provided in JSF portlet bridge 2.0 which will be shipped as an update to WAS. It is currently in the planning stages so I cannot give you a precise version that this will be found in.

栀梦 2024-12-19 01:59:16

我不想这么说,但如果我们谈论的是异步 Web 应用程序,那么您就完蛋了。

JSF 1.2 引入了一个“已知错误”(我一直很喜欢这句话),即 FaceletsRenderer 类,它会阻止您异步渲染 JSF 组件(因为 JSF 中的所有异步性都使用伪造的 FacesContext;不是可用于渲染的函数式上下文)。 您需要 JEE6 友好的 JSF 2.1,否则您将需要完全不同的解决方案,正如 @D1e 在他/她的评论中指出的那样。祝您的组织好运。

I hate to say it, but if we're talking about an asynchronous web application, then you're dead in the water.

JSF 1.2 introduced a "known bug" (I always loved that phrase) is the FaceletsRenderer class that prevents you from asynchronously rendering JSF components (because all aynchronousity in JSF uses a faked FacesContext; not a functional one that can be used for rendering). You need JEE6-friendly JSF 2.1 for that, otherwise you'll need a different solution altogether, as @D1e pointed out in his/her comment. Best of luck to your organization.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文