【发布时间】:2016-05-14 04:48:09
【问题描述】:
我想在 gwt 中生成<ul><li> 元素。我想知道如何实现这一目标。有人可以帮忙吗?
我使用 gwt 2.7
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'
>
<li ui:field="listItem" class="menu open">
<m:MaterialLink ui:field="hyperlink" textColor="blue"></m:MaterialLink>
</li>
</ui:UiBinder>
Java 代码
@UiField LIElement listItem;
控制台输出
[INFO] GET /recompile/cms
[INFO] Job pl.daniel.cms.cms_1_69
[INFO] starting job: pl.daniel.cms.cms_1_69
[INFO] Compiling module pl.daniel.cms.cms
[INFO] Computing all possible rebind results for 'pl.daniel.cms.client.ui.template.menu.GatekeeperProtectedMenuEntry.Binder'
[INFO] Rebinding pl.daniel.cms.client.ui.template.menu.GatekeeperProtectedMenuEntry.Binder
[INFO] Invoking generator com.google.gwt.uibinder.rebind.UiBinderGenerator
[INFO] [ERROR] Not allowed in an HTML context: <m:MaterialLink textColor='blue' ui:field='hyperlink'> (:12)
[INFO] [ERROR] Errors in 'gen/pl/daniel/cms/client/ui/template/menu/com_gwtplatform_mvp_client_DesktopGinjector_DesktopGinjectorGinjector_fragment.java'
[INFO] [ERROR] Line 93: Failed to resolve 'pl.daniel.cms.client.ui.template.menu.GatekeeperProtectedMenuEntry.Binder' via deferred binding
[INFO] Unification traversed 1505 fields and methods and 454 types. 7 are considered part of the current module and 7 had all of their fields and methods traversed.
[INFO] [WARN] Some stale types ([pl.daniel.cms.client.ui.template.menu.GatekeeperProtectedMenuEntry_BinderImpl, pl.daniel.cms.client.ui.template.menu.GatekeeperProtectedMenuEntry_BinderImpl$Widgets]) were not reprocessed as was expected. This is either a compiler bug or a Generator has legitimately stopped creating these types.
[INFO] [ERROR] Compiler returned false
[INFO] [WARN] recompile failed
[INFO] [WARN] continuing to serve previous version
【问题讨论】:
-
你看过this的答案吗?
-
是的。但我想在
li元素内有小部件,但我不能那样做。 -
答案在
li中放置了一个InlineHyperlink,这是一个小部件。 -
是的。但在我的情况下,我遇到了编译错误,说我不能将小部件放入
<li>元素中。奇怪的。你能解释一下我为什么会出现这个错误吗?我做错了什么? -
请将
ui.xml文件内容(或至少相关位)添加到您的问题中。确切的错误也会有所帮助。
标签: java html gwt widget uibinder