【发布时间】:2014-07-28 17:41:52
【问题描述】:
这是我的问题。例如,我有一些 HTML 文件 Description.html,它包含类似这样的内容
<p>
<img src="Bill.jpg">
</p>
Bill.jpg 与 html 文件在同一目录中。
我还有 UiBinder 小部件,其中包含称为 panel 的 SimplePanel。
在这个小部件的 ui.xml 中看起来像
...
<ui:style src="../Style.css"/>
<g:SimplePanel ui:field="panel" addStyleNames="{style.description}" />
...
这个小部件的构造函数是:
public SomeWidget() {
initWidget(uiBinder.createAndBindUi(this));
panel.setWidget(new HTMLPanel(HtmlTextResources.htmlFile().getText());
}
问题的关键 - bill.img 不显示。 控制台显示
> [WARN] 404 - GET /bill.jpg (127.0.0.1) 1373 bytes Request headers
> Host: 127.0.0.1:8888
> Connection: keep-alive
> Cache-Control: no-cache
> Accept: image/webp,*/*;q=0.8
> Pragma: no-cache
> User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153
> Safari/537.36
> *****************
> Accept-Encoding: gzip,deflate,sdch
> Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4,it;q=0.2,uk;q=0.2 Response
> headers
> Content-Type: text/html;charset=ISO-8859-1
> Cache-Control: must-revalidate,no-cache,no-store
> Content-Length: 1373
我该如何解决这个问题?需要通过html使用图片
【问题讨论】:
-
如果没有进一步的了解,我猜“bill.jpg”不在您的服务器提供的根文件夹中。也许它存在于子目录中。也许stackoverflow.com/questions/15071517/… 是有价值的。
标签: java html gwt gxt uibinder