jsp页面是如何执行的,其原理是什么?
我正在阅读构建 Web 应用程序骨架的步骤:
http://maestric.com /doc/java/spring/setup#web_app_sculpture
感觉和PHP等其他语言有很大的不同。
它是如何执行的?
I'm reading the steps to build a web app skeleton:
http://maestric.com/doc/java/spring/setup#web_app_skeleton
And feel it's greatly different from other languages like PHP.
How is it executed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
web.xml 是部署描述符。它实际上并没有以某种方式工作,服务器(servlet 容器)读取此文件以了解应用程序的需求是什么(要创建哪些过滤器、servlet、配置参数等)。
考虑一下 CGI。在 CGI 中,您有执行并输出 HTML 的代码。 Java 中的等效项是 Servlet。您有包含 HTML 的 Java 代码。
JSP 是一个彻底翻转的 Servlet。您有包含 Java 代码的 HTML。当“执行”JSP 时,服务器实际上会将其彻底翻转并将其转换为 Servlet。
然后执行 servlet,而不是 JSP。
PS这当然是一个简单的描述,幕后还发生了很多事情。
web.xml is a deployment descriptor. It does not actually work in a way, the server (servlet container) reads this file to know what your application's needs are (what filters to create, servlets, configuration params etc).
Consider CGI for a second. In a CGI you have code that is executed and outputs HTML. The equivalent of this in Java is a Servlet. You have Java code that includes HTML.
The JSP is a Servlet turned inside out. You have HTML that includes Java code. When "executing" a JSP, the server will in fact turn it inside out and transform it into a Servlet.
The servlet is then executed, not the JSP.
P.S. this is off course a simplistic description, a lot more is going on behind the scenes.