IK.AM

@making's tech note


ThymeLeafでjavascriptにcontextPathを設定する

🗃 {Programming/Java/org/thymeleaf}
🗓 Updated at 2012-09-25T08:03:34Z  🗓 Created at 2012-09-25T08:03:34Z   🌎 English Page

ThymeLeafでJSPの${pageContext.request.contextPath}request.getContextPath()<c:url>相当の結果をjavascriptに設定する方法

<script type="text/javascript" th:inline="javascript">
<!--
  var foo = {}; // namespace
  foo.CONTEXT_ROOT = /*[[${#httpServletRequest.contextPath}]]*/ '';
//-->
</script>

http://www.thymeleaf.org/doc/Tutorial%20-%20Using%20Thymeleaf%2020120910.pdf の20ページ目と50ページ目を参考


✒️️ Edit  ⏰ History  🗑 Delete