How to access JSTL tag from JavaScript

你说的曾经没有我的故事 提交于 2020-01-03 02:28:52

问题


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?


回答1:


This is JSP

<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>

<script>
function displayErrors() {  
   alert("<form:errors path='*'>");
}
</script>

You can use JSTL tags inside JSP file, not JS file.



来源:https://stackoverflow.com/questions/39944149/how-to-access-jstl-tag-from-javascript

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