脚本标记具有src属性时JSPX分页符

时间:2013-03-18 13:09:01

标签: spring jsp jstl jsp-tags jspx

由于某些奇怪的原因,每当我将src元素添加到此JSPX块末尾的script标记时,页面的前半部分都拒绝加载。在线路输出之前切割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> 

0 个答案:

没有答案