1

我想调用一个具有 GWT 模块的 JSP,main.jsp其中包含页眉和页脚。这些 GWT 模块应该加载到main.jsp. 根据从 header.jsp 中单击的链接,相应的 GWT 模块应加载到的正文中main.jsp

<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>
4

1 回答 1

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

希望对您有所帮助。

于 2013-05-24T13:00:03.437 回答