如何从JavaScript访问JSTL标记 [英] How to access JSTL tag from JavaScript
本文介绍了如何从JavaScript访问JSTL标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否允许在JavaScript文件中调用JSTL标记,如下例所示:
Is it allowed to call JSTL tag inside JavaScript file like the following example :
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
function displayErrors() {
alert("<form:errors path='*'>");
}
如果允许,如何使其正常工作?
If allowed, how to make it work correctly?
推荐答案
这是JSP
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<script>
function displayErrors() {
alert("<form:errors path='*'>");
}
</script>
你可以在JSP文件中使用JSTL标签,而不是JS文件。
You can use JSTL tags inside JSP file, not JS file.
这篇关于如何从JavaScript访问JSTL标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文