Java 可以注释掉 JSTL 代码吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3914099/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 06:47:15  来源:igfitidea点击:

Possible to comment-out JSTL code?

javajspjstlcomments

提问by faq

If you want to temporarily comment-out a piece of JSTL code that you may re-enable later, is this possible?

如果您想暂时注释掉一段 JSTL 代码,稍后您可能会重新启用,这可能吗?

Would this work?

这行得通吗?

<!--<c:out value="${someVar}"/>-->

回答by Nikita Rybak

<%-- <c:out value="${someVar}"/> --%>

This way, none of jstl code inside will be executed.

这样,里面的任何jstl代码都不会被执行。

回答by Romain Linsolas

When you write such comment in your JSP file:

当您在 JSP 文件中编写此类注释时:

<!-- <c:out value="${someVar}"/> -->

This means that this comment will be outputed, i.e. present in the generated HTML page. If you want to hide your code, use the JSP comments:

这意味着该评论将被输出,即出现在生成的 HTML 页面中。如果要隐藏代码,请使用 JSP 注释:

<%-- <c:out value="${someVar}"/> --%>