问题
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