如何将包含GWT模块的jsp加载到包含页眉和页脚的main.jsp中

时间:2013-05-24 07:03:49

标签: jquery gwt

我想从main.jsp调用一个包含页眉和页脚的GWT模块的JSP。这些GWT模块应该加载到main.jsp的主体上。基于从header.jsp点击的链接,应该在main.jsp的主体内加载相应的GWT模块:

<html>
 <head>
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">
   </script>
  <script>
   $(document).ready(function() {
   $("#clickMe").click(function() {
   // This gwtModule.jsp contains only GWT module.
   $("#name").load("/gwtModule.jsp");
    });
   });
   </script>
 </head>
 <body>
  ${headerAndMenuCache}
   <h1>Web Application Starter Project</h1>
    <a href="#" id="clickMe">clickMe</a>
    <div id="name">
    </div>      
    <jsp:include page="/footer.jsp" />
 </body>
</html>

1 个答案:

答案 0 :(得分:0)

  1. 如果未加载GWT nocache js,请尝试使用jQuery.getScript()而不是jQuery.load()
  2. 确保您的GWT脚本已准备好将必要的组件呈现到某个div中。您需要在入口点设置此项:
  3. SimplePanel appWidget = new SimplePanel();
    activityManager.setDisplay(appWidget);
    // I suppose that you want to use your <div id="name">
    RootPanel.get("name").add(appWidget);
    

    希望它对你有所帮助。