【问题标题】:how to include header and footer files usinig gwt?如何使用 inig gwt 包含页眉和页脚文件?
【发布时间】:2016-10-17 09:27:30
【问题描述】:

我正在尝试使用 gwt 创建一个 webApplication,我的想法是制作一个页眉和页脚文件以包含在所有页面中。我尝试为此使用 UiBinder,但它不起作用。

 <!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:g="urn:import:com.google.gwt.user.client.ui">
    <g:DockLayoutPanel unit="EM">
        <g:north size="5">
            <!-- I want to include my heaader file here -->
        </g:north>
      </g:DockLayoutPanel>
</ui:UiBinder> 

有什么想法吗?

【问题讨论】:

  • 你试图做什么?发布一些显示最简单的工作(不工作)场景的代码
  • 完成..你现在可以看到我想要的了。
  • 与其到处重复页眉和页脚,不如只更改非页眉非页脚部分?

标签: jakarta-ee gwt uibinder


【解决方案1】:

你可以这样做:

 <!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:g="urn:import:com.google.gwt.user.client.ui">
    <g:DockLayoutPanel unit="EM">
        <g:north size="5">
            <!-- I want to include my heaader file here -->
             <g:HTML ui:field="header">
                <OBJECT data="file_to_include.html">
                   Warning: file_to_include.html could not be included.
                 </OBJECT>
             </g:HTML>
        </g:north>
        <g:center>
            <g:DeckLayoutPanel ui:field="containerDiv" height="100%" width="100%" animationDuration="900" />
        </g:center>
      </g:DockLayoutPanel>
</ui:UiBinder> 

编辑:要包含一个 html 文件,您只需 include your header.html

您将实例化该类一次,然后更改containerDiv 的内容。 containerDiv 可以是你想要的任何类型,不一定是DeckLayoutPanel

【讨论】:

  • 感谢您的回答,但我有一个 htmt 文件 (header.html),其中包含标题的 html 代码。我不想将 html 代码放在 标记之间,我只想知道是否有可能在此处包含我的 header.html。
  • 啊,好吧,然后把它放在你的问题中,这样它就清楚你想要什么。无论如何我编辑了我的答案
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-04-03
  • 2013-09-13
  • 2013-07-05
  • 2018-06-24
  • 2012-06-18
  • 1970-01-01
相关资源
最近更新 更多