JSP通常以.jsp文件,预编译的Java文件或预编译的类文件的形式发布吗? [英] Are JSPs generally shipped as .jsp files , pre-compiled Java files or pre-compiled class files?

查看:274
本文介绍了JSP通常以.jsp文件,预编译的Java文件或预编译的类文件的形式发布吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



是否将它们包含为.jsp文件?



还是将它们作为预编译的Java文件或预编译的类文件?

解决方案

Servelts / JSP规范什么也没有说明预编译JSP,使得这个特性特定于容器实现。您可以为特定的容器预编译,比如对于Tomcat或WebLogic,您一定会发现Ant任务。



通常,当您打包应用程序时,您就可以了解自己的目标。如果它是多个容器(比如说可以下载的产品),那么你唯一的选择就是把原始的JSP包装到你的WAR文件中。但是,当您正在开发和/或测试时,您可以预先编译作为构建过程的一部分,以确保您的JSP正确,并且b)加快启动时间。如果您在构建软件时需要额外的验证步骤,您甚至可以让Eclipse为您做。



我不认为有行业做法一种或另一种方式。从我所经历的,JSP通常被打包为原始(未预编译)用于部署和分发,但是作为构建/测试过程的一部分进行预编译。


Is there a 'standard' practice for packaging JSPs when preparing WAR for Production Env?

Are they included as ".jsp" files?

Or are they included as pre-compiled Java files, or pre-compiled class files?

解决方案

The Servelts/JSP spec says nothing about precompiling JSPs making this feature specific to container implementation. You can pre-compile for a specific container, say for Tomcat or for WebLogic and you will surely find Ant tasks to do so.

Generally, when you package your app you know your target. If it's more than one container (say you package a downloadable product) then your only option is to package raw JSPs into your WAR file. That said, however, when you're in development and/or testing you certainly can pre-compile as part of your build process to a) validate that your JSPs are correct and b) speed up the start-up time. You can even have your Eclipse do it for you if you need that extra validation step as you are building your software.

I don't think there's an industry practice to do one way or the other. From what I have experienced the JSPs are usually packaged "raw" (not pre-compiled) for deployment and distribution but are pre-compiled as part of build/test process.

这篇关于JSP通常以.jsp文件,预编译的Java文件或预编译的类文件的形式发布吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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