来自jsf-api-2.2.0-m05.jar的javax.faces-2.1.14.jar和jsf-impl-2.2.0-m05.jar之间的区别是什么? [英] What is the difference between javax.faces-2.1.14.jar from jsf-api-2.2.0-m05.jar and jsf-impl-2.2.0-m05.jar

查看:82
本文介绍了来自jsf-api-2.2.0-m05.jar的javax.faces-2.1.14.jar和jsf-impl-2.2.0-m05.jar之间的区别是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对来自jsf-api-2.2.0-m05.jar的javax.faces-2.1.14.jar和jsf-impl-2.2.0-m05.jar
的区别感到困惑我正在尝试在不使用maven的情况下创建一个jsf项目,在搜索示例时,我在不同的教程中看到了不同的jar依赖项。来自 coreservlets 的教程使用javax.faces-2.1.14.jar和我从另一个看到的另一个教程site使用2个jar文件jsf-api-2.2.0-m05.jar和jsf-impl-2.2.0-m05.jar
我想知道这两组依赖项的区别。
先谢谢你们。

I am confused between the difference of javax.faces-2.1.14.jar from jsf-api-2.2.0-m05.jar and jsf-impl-2.2.0-m05.jar I am trying to make a jsf project without using maven and while searching for examples I saw different jar dependencies on different tutorials. The tutorial from coreservlets uses javax.faces-2.1.14.jar and the other tutorial I saw from a different site uses 2 jar files jsf-api-2.2.0-m05.jar and jsf-impl-2.2.0-m05.jar Id like to know the difference of these two set of dependencies. Thanks in advance guys.

推荐答案

jsf-api-xxx.jar 包含java包 javax.faces 包下的类。这个jar中的类是JSF规范定义的标准API的实现。 jsf-impl-xxx.jar 包含java包 com.sun.faces 下的类,其中包含java包表示,是Sun自己的JSF实现类。

The jsf-api-xxx.jar contains classes that are under packages java package javax.faces. The classes in this jar are implementation of standard API defined by JSF specification. The jsf-impl-xxx.jar contains classes that are under java package com.sun.faces, which as the java package indicates, is Sun's own class for JSF implementation.

javax.faces-xxx.jar 实际合并将前两个jar文件放在一起。在Maven存储库中,它位于 org.glassfish groupId下。你会在里面找到 javax.faces com.sun.faces java包。

The javax.faces-xxx.jar actually merges the previous two jar files together. In the Maven repository, it is under org.glassfish groupId. You will find both javax.faces and com.sun.faces java package inside.

那么你应该用什么开发?实际上你可以使用两者。但推荐的方法是仅在编译类路径中包含 jsf-api-xxx.jar 。因此,您自己的应用程序不依赖于 com.sun.faces 包下的任何类来实现可移植性到其他JSF实现。如果您使用的是GlassFish等应用程序,则容器应该已经在运行时提供了JSF实现。您不应该使用war或ear文件打包上述JSF jar文件,因为服务器将提供所有这些文件。如果您使用默认情况下没有JSF实现的容器(如Tomcat),则需要打包 javax.faces-xxx.jar 或( code> WEB-INF / lib中的> jsf-api-xxx.jar + jsf-impl-xxx.jar ) 。

So what should you use for your development? Actually you can use both. But the recommended way is to include jsf-api-xxx.jar only in the compilation classpath. Thus your own application does not depend on any classes under com.sun.faces package to achieve the portability to other JSF implementations. If you are using an application such as GlassFish, the container should already provide the JSF implementation at runtime. You should not package the above JSF jar files with your war or ear file, as server will provide all of them. If you use a container that does not come with a JSF implementation by default such as Tomcat, you need to package javax.faces-xxx.jar or (jsf-api-xxx.jar + jsf-impl-xxx.jar) in the WEB-INF/lib.

这篇关于来自jsf-api-2.2.0-m05.jar的javax.faces-2.1.14.jar和jsf-impl-2.2.0-m05.jar之间的区别是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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