0

コントローラには、searchResultGraph.jspという名前のjspに文字列を渡す必要があるハンドラメソッドがあります。

@RequestMapping(value = PATHELEM + "/searchGraph")
    public String handleGraph(Model model) {
        String write = writer.getWriteString();
        model.addAttribute("write", write);
        System.out.println(write);
        return PATHELEM + "/searchResultGraph";
    }

jspは次のようになります。

<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="core"%>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
        <title>Graph View</title>
        <script type="text/javascript" src="<c:url value="/resources/js/json2.min.js" />"></script> <!-- ${pageContext.request.contextPath}/WebContent/WEB-INF/views/ -->
        <script type="text/javascript" src="<c:url value="/resources/js/cytoscapeweb.min.js" />"></script>
        <script type="text/javascript" src="<c:url value="/resources/js/AC_OETags.min.js" />"></script>


        <script language="JavaScript">
            window.onload=function() {
                        // network data could alternatively be grabbed via ajax
                 var xml = '${write}';

                        // 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>
        <h1>${write}</h1>
        <div id="cytoscapeweb">
             Cytoscape Web will replace the contents of this div with your graph.
             ${write}
        </div>
    </body>
</html>

しかし、電話をかけようとすると何も表示されません${write}。私の方法に何か足りないものはありますか?

ありがとう!

4

2 に答える 2

0

getWriteString();という名前のメソッドを使用しているかどうかを確認してください。Beanクラスで、クラス名を作成しない場合は、コントローラーでwriteという名前のオブジェクトを記述してインスタンス化し、それに文字列を渡してモデルに追加し、コントローラーによってそれを返します。

Write write = new Write();
write.getWriteString();
于 2012-12-10T12:49:45.877 に答える
0

わかりました、私は解決策を見つけました:

options-tagのリンクも相対リンクである必要がありました!

だからこれの代わりに

var options = {
                swfPath: "CytoscapeWeb",
                flashInstallerPath: "playerProductInstall"
              };

私はこれを書かなければなりませんでした:

var options = {
                 swfPath: "<c:url value="/resources/js/CytoscapeWeb" />",
                 flashInstallerPath: "<c:url value="resources/js/playerProductInstall" />"
              };
于 2012-12-17T07:56:59.453 に答える