jsf和javascript是不兼容的



我正在将一个html文件迁移到jsf文件,但一个脚本失败了,该脚本在安装在wamp服务器中的html中工作。

代码:

> <h:head>
>         <meta charset="utf-8"/>
>         <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
>         <title></title>
>         <meta name="description" content=""/>
>         <meta name="viewport" content="width=device-width, initial-scale=1"/>
>         <link rel="stylesheet" href="../css/media-queries.css" media="screen" />
>         <script type="" src="../js/vendor/modernizr.2.6.2.min.js"></script>
>         <script type="" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
>         <script type="text/javascript">window.jQuery || document.write('<script
> src="../js/vendor/jquery-1.8.0.min.js"></script>')</script> <!--  This is the line 21 -->
>         <script type="" src="../js/jquery.mobile.min.js"></script>
>         <script type="" src="../js/jquery.dataTables.min.js"></script>
>         <script type="" src="../js/jquery.formCharmer.js"></script>
>         <script type="">if(Modernizr.csstransitions){document.write('<link
> rel="stylesheet" href="../css/charmerAnimation.css"/>')}</script>
>         <!--[if (gte IE 6)&(lte IE 8)]>
>             <script src="../js/selectivizr.min.js"></script>
>         <![endif]-->
>         <!--[if lte IE 9]>
>             <script src="../js/css3-mediaqueries.js"></script>
>         <![endif]-->
>     </h:head>

错误:

HTTP状态500-分析/content/contentA.xhtml时出错:错误跟踪[line:21]元素的内容必须由数据标记组成或正确的格式。

这是HTML代码:

<head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <title></title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="../css/media-queries.css" media="screen" />
        <script src="../js/vendor/modernizr.2.6.2.min.js"></script>
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
        <script>window.jQuery || document.write('<script src="../js/vendor/jquery-1.8.0.min.js"></script>')</script>
        <script src="../js/jquery.mobile.min.js"></script>
        <script src="../js/jquery.dataTables.min.js"></script>
        <script src="../js/jquery.formCharmer.js"></script>
        <script>if(Modernizr.csstransitions){document.write('<link rel="stylesheet" href="../css/charmerAnimation.css">')}</script>     
        <!--[if (gte IE 6)&(lte IE 8)]>
            <script src="../js/selectivizr.min.js"></script>
        <![endif]-->
        <!--[if lte IE 9]>
            <script src="../js/css3-mediaqueries.js"></script>
        <![endif]-->
    </head>

Facelets是一种基于XML的视图技术。<>是XML中的保留字符,表示元素的开始和结束。然而,您正试图将它作为JavaScript字符串变量的一部分输出。您需要将它们表示为&lt;&gt;

<script>window.jQuery || document.write('&lt;script src="../js/vendor/jquery-1.8.0.min.js"&gt;&lt;/script&gt;')</script>

这同样适用于代码中更靠下的&字符,它表示实体的开始。顺便说一句,一旦你解决了这个问题,IE条件注释就出现了一个新问题,答案是:&lt--[如果IE]>条件注释在Facelets中呈现为HTML转义。

相关内容

  • 没有找到相关文章

最新更新