Are JSPs generally shipped as .jsp files , pre-com

2019-05-16 11:20发布

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?

3条回答
SAY GOODBYE
2楼-- · 2019-05-16 11:59

They are packaged as .jsp files itself. Please do take care about the jsp file size limit of 64K jsp file size limit

查看更多
闹够了就滚
3楼-- · 2019-05-16 12:02

In my experience, they are just shipped in the WAR as .jsp files. The application server will automatically compile the .jsp into a class file. See here for more info on the jsp life cycle.

查看更多
在下西门庆
4楼-- · 2019-05-16 12:08

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.

查看更多
登录 后发表回答