0

我正在尝试将 javascript-tags 包含到 jsp 文件中,但它没有被渲染。代码如下所示:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <title>Insert title here</title>
    <script language="JavaScript" src="AC_OETags.min.js"></script>
    <script language="JavaScript" src="json2.min.js"></script>
    <script language="JavaScript" src="cytoscapeweb.min.js"></script>  
    <script language="JavaScript">
        window.onload=function() {
                    // network data could alternatively be grabbed via ajax
             var xml = '\
            <graphml>\
            <key id="label" for="all" attr.name="label" attr.type="string"/>\
            <key id="weight" for="node" attr.name="weight" attr.type="double"/>\
            <graph edgedefault="undirected">\
                <node id="1"><data key="label">1</data><data key="weight">1.8</data></node>\
                <node id="2"><data key="label">2</data><data key="weight">1.1</data></node>\
                <node id="3"><data key="label">3</data><data key="weight">1.1</data></node>\
                <node id="4"><data key="label">4</data><data key="weight">1.1</data></node>\
                <node id="5"><data key="label">5</data><data key="weight">.3</data></node>\
                <node id="6"><data key="label">6</data><data key="weight">.3</data></node>\
                <edge source="1" target="2" ></edge>\
                <edge source="2" target="3" ></edge>\
                <edge source="4" target="5" ></edge>\
                <edge source="3" target="4" ></edge>\
                <edge source="6" target="5" ></edge>\
                <edge source="4" target="2" ></edge>\
                <edge source="6" target="1" ></edge>\
            </graph>\
            </graphml>\
            ';

                    // init and draw
                    // initialization options
                        var options = {
                            swfPath: "CytoscapeWeb",
                            flashInstallerPath: "playerProductInstall"
                        };

                        var vis = new org.cytoscapeweb.Visualization("cytoscapeweb", options);

                        var draw_options = {
                            // your data goes here
                            network: xml,

                            // show edge labels too
                            edgeLabelsVisible: false,

                            edgeTooltipsEnabled:true,

                            // let's try another layout
                            layout: "circle",

                            // hide pan zoom
                            panZoomControlVisible: true
                        };

                        vis.draw(draw_options);

                    };
    </script>

    <style>
        /* The Cytoscape Web container must have its dimensions set. */
        html, body { height: 100%; width: 100%; padding: 0; margin: 0; }
        #cytoscapeweb { width: 100%; height: 100%; }
    </style>
</head>
<body>
    <h1>The Graph</h1>
    <div id="cytoscapeweb">
         Cytoscape Web will replace the contents of this div with your graph.
    </div>
</body>
</html>

它使用 Cytoscape Web 来呈现图形。如果我从普通的 html 文件运行它,一切都可以正常工作......

有什么建议么?

4

1 回答 1

0

我必须包括这样的链接:

<script language="JavaScript" src="<%@ include file="AC_OETags.min.js" %>"></script>
<script language="JavaScript" src="<%@ include file="json2.min.js" %>"></script>
<script language="JavaScript" src="<%@ include file="cytoscapeweb.min.js" %>"></script> 
于 2013-04-23T07:23:32.217 回答