この JSPX ブロックの末尾にある script タグに src 要素を追加すると、何らかの奇妙な理由で、ページの前半がロードを拒否されます。行の前に HTML を切り取り、ページを完全にホースします。ここでは、CDATA ブロック、スクリプトのインライン化、ページからの完全な削除など、いくつかの異なるオプションを試しました。何らかの理由で、そのスクリプト ブロック内にレンダリングするものがあると、ページが壊れます。
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:spring="urn:jsptld:/WEB-INF/tlds/spring.tld"
xmlns:spring-form="urn:jsptld:/WEB-INF/tlds/spring-form.tld"
xmlns:intela-coreg="urn:jsptld:/WEB-INF/tlds/intela-coreg.tld"
xmlns:c="urn:jsptld:/WEB-INF/tlds/c.tld"
xmlns:x="urn:jsptld:/WEB-INF/tlds/x.tld"
xmlns:fmt="urn:jsptld:/WEB-INF/tlds/fmt.tld"
xmlns:fn="urn:jsptld:/WEB-INF/tlds/fn.tld"
xmlns:intela="urn:jsptagdir:/WEB-INF/tags/intela" version="2.0">
<jsp:directive.page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"/>
<c:set var = "myPath" value ="${sessionPath.regPath.pathName}" />
<c:set var = "pathParts" value="${fn:split(myPath, '_')}" />
<c:set var = "myPathPlacement" value = "${pathParts[0]}" />
<!-- Add the container code based on domain -->
<c:choose>
<!-- Australia -->
<c:when test ="${myPathPlacement == 'ap'}">
<c:set var ="gCode" value ="GTM-FR7W" />
</c:when>
<c:when test ="${myPathPlacement == 'as'}">
<c:set var ="gCode" value ="GTM-64GD" />
</c:when>
<c:when test ="${myPathPlacement == 'xaph'}">
<c:set var ="gCode" value ="GTM-TBNP" />
</c:when>
<!-- Canada -->
<c:when test ="${myPathPlacement == 'cp'}">
<c:set var ="gCode" value ="GTM-J578" />
</c:when>
<c:when test ="${myPathPlacement == 'xcph'}">
<c:set var ="gCode" value ="GTM-6WG2" />
</c:when>
<!-- Netherlands -->
<c:when test ="${myPathPlacement == 'nl2'}">
<c:choose>
<c:when test = "${pathParts[1] == 'voucher'}" >
<c:set var ="gCode" value ="GTM-6S7B" />
</c:when>
<c:when test = "${pathParts[1] == 'scooter'}">
<c:set var ="gCode" value = "GTM-8W4R" />
</c:when>
</c:choose>
</c:when>
<!-- Spain -->
<c:when test ="${myPathPlacement == 'es'}">
<c:choose>
<c:when test = "${fn:contains(pathParts[1], 'apple')}" >
<c:set var ="gCode" value ="GTM-JVG5" />
</c:when>
<c:when test = "${pathParts[1] == 'elcorteingles'}">
<c:set var ="gCode" value = "GTM-53L3" />
</c:when>
</c:choose>
</c:when>
<!-- France -->
<c:when test ="${myPathPlacement == 'fr'}">
<c:choose>
<c:when test = "${fn:contains(pathParts[1], 'peage')}" >
<c:set var ="gCode" value ="GTM-F5DR" />
</c:when>
</c:choose>
</c:when>
<c:when test ="${myPathPlacement == 'fr2'}">
<c:set var ="gCode" value ="GTM-ZG2J" />
</c:when>
<!-- UK -->
<c:when test ="${myPathPlacement == 'hp'}">
<c:choose>
<c:when test = "${pathParts[1] == 'uk'}" >
<c:set var ="gCode" value ="GTM-4LX8" />
</c:when>
</c:choose>
</c:when>
<c:when test ="${myPathPlacement == 'p2w'}">
<c:set var ="gCode" value ="GTM-S73N" />
</c:when>
<c:when test ="${myPathPlacement == 'pu'}">
<c:set var ="gCode" value ="GTM-7BRV" />
</c:when>
<c:when test ="${myPathPlacement == 'xurt'}">
<c:set var ="gCode" value ="GTM-TH5Q" />
</c:when>
<c:when test ="${myPathPlacement == 'TechRewardsUK'}">
<c:set var ="gCode" value ="GTM-Q3PL" />
</c:when>
<!-- USA -->
<c:when test ="${myPathPlacement == 'cd'}">
<c:set var ="gCode" value ="GTM-B4D5" />
</c:when>
<c:when test ="${myPathPlacement == 'uspr'}">
<c:set var ="gCode" value ="GTM-PZTJ" />
</c:when>
<c:when test ="${myPathPlacement == 'usrt'}">
<c:set var ="gCode" value ="GTM-QMZG" />
</c:when>
<c:when test ="${myPathPlacement == 'ussr'}">
<c:set var ="gCode" value ="GTM-GRJK" />
</c:when>
<c:when test ="${myPathPlacement == 'us'}">
<c:set var ="gCode" value ="GTM-W285" />
</c:when>
</c:choose>
<c:set var = "gCodeLength" value = "${fn:length(gCode)}" />
<!-- Test to see if this page needs the code or move along, these are not the droids we are looking for -->
<c:if test = "${gCodeLength > 0}" >
<script src="/media/common/js/googleTagManager.js"><!-- test --></script>
</c:if>