Reloading JSTL Tag files in Tomcat development mode

天大地大妈咪最大 提交于 2021-01-29 14:19:45

问题


The application I just inherited defines .tag files - ie JSTL tags written in JSP and other JSTL tags. Is it possible for Tomcat to pick up on changes to .tag files and recompile/reload them without a restart, in the same manner of "development" mode for JSPs?

Edit I should have noted that the context is marked as "reloadable" in Tomcat, and I'm successfully hot-deploying class files and jsps. It's just not picking up on .tag files.


回答1:


"development" mode for JSPs applies for the tag files too ... unless the tag files are being packaged in a jar file (e.g. in /META-INF/tags/ of a jar file in /WEB-INF/lib).

If the tag files are being deployed like the JSPs (e.g. in /WEB-INF/tags/) they will be checked for modification and reloaded on each access if "development" mode is true. You shouldn't have to set it explicitly as it's true by default in tomcat 5.5/6.

If you check $CATALINA_BASE/conf/web.xml and "development" isn't explicitly set to false but you're still getting issues with reload of .tag files (assuming these aren't jar-packaged) you could try turning off tag pools (for the jasper, JspServlet):

<init-param>
    <param-name>enablePooling</param-name>
    <param-value>false</param-value>
</init-param>

... but this really shouldn't be necessary.




回答2:


Libraries/files in classpath won't be hotdeployed/hotloaded in Tomcat. As far as I know, Glassfish v3 is the only who can do that. Tomcat can only hotdeploy changes in JSP files and Java source files. However, since Tomcat is a pretty quick (re)starter (done in less than 3 seconds in contrary to around 30 seconds for Glassfish), manually restarting shouldn't be a major issue, is it? A hotdeploy itself would already take about the same time.



来源:https://stackoverflow.com/questions/3319740/reloading-jstl-tag-files-in-tomcat-development-mode

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!