JSTL and Javascript

Are there any tags inside the jstl tag that are considered bad? So for example, I know that the following will work, but is bad form considered script tags inside my jstl tags in my jsp?

<c:choose>
  <c:when test="${!empty bean.value}">
    <p>Its not empty</p>
  </c:when>
  <c:otherwise>
    **<script>
        callJSSomeFunction();
    </script>**
  </c:otherwise>
</c:choose>
+3
source share
3 answers

I don’t know about the bad form (a little tough), but you might think that someone, viewing your page without JS, yours <c:otherwise>will effectively output nothing, and this is not very graceful.

, , , , , DOM , , ( ), ).

, DOM (jQuery $(document).ready(), ,), .

+4

- - JSTL, , script, .

+2

JDSL-terds punchbowl, , UI dev .

SGM- , SGM- , , , . , . , vars HTML , , .

, , , , , PITA UI , , . , , Java , , .

, . , , Java , . ? , . , , JavaScript- Java ( - ), , . , , .

, . JSON, -, , JS . , , UI , - bean, , HTTP, , - . . , " " .

"" . , , , .

+1

Source: https://habr.com/ru/post/1712156/


All Articles