仅包括jstl实现jar [英] Including jstl implementation jar only

查看:68
本文介绍了仅包括jstl实现jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是 answer ,下面是一个简单的jsp演示,其中仅包含jstl实现jar(javax.servlet.jsp.jstl-1.2.1.jar),但是不是jstl API jar(javax.servlet.jsp.jstl-api-1.2.1.jar)

Following this answer, below is a simple jsp demo that includes only jstl implementation jar(javax.servlet.jsp.jstl-1.2.1.jar), but not jstl API jar(javax.servlet.jsp.jstl-api-1.2.1.jar),

我的理解是,jstl实现jar同时包含API(主要是java接口)及其实现.这就是test.jsp成功编译并执行的原因.

My understanding is, jstl implementation jar holds both API(mostly java interfaces) and it's implementation. This is the reason test.jsp got compiled and executed successfully.

此外,相同的方法也可以使用tomcat容器提供的API实现jar来使用servlet,而无需使用API​​(servlet-api.jar).

Further, same approach would work with servlets using API implementation jar provided by tomcat container without using API(servlet-api.jar).

这是正确的理解吗?

推荐答案

Api仅包含您需要编译代码的接口.该实现可以在不同的库中.

Api contains only interfaces you need to compile your code. The implementation could be in different library.

Tomcat和任何其他Java Web服务器在运行时提供实现,因此您无需打包已实现的分类并随您的应用一起使用.

Tomcat and any other Java web servers provide implementation at runtime, so you don't need to package implemented classed and carry on them with your app.

如果部署包含impl类的应用程序,则可以在日志中看到是否已经加载了实现.

You could see in the logs if implementation is already loaded if you deploy your application that contains classes impl.

这篇关于仅包括jstl实现jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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