我想添加一個點擊處理程序到gwt html面板中定義的錨點,但沒有成功。我使用下面的方法GWT添加事件處理程序到DOM元素
panel_1 = new HTMLPanel("<div class='BackHeader'>Selected Attribute:Select an Attribute to edit(<a Id='DeleteCategory'>Delete this Attribute</a>)</div>");
flexTable.setWidget(3, 0, panel_1);
Element DeleteCategory=panel_1.getElementById("DeleteCategory");
Anchor C= Anchor.wrap(DeleteCategory);
但我收到以下錯誤:
Exception while loading module com.BiddingSystem.client.BiddingSystem. See Development Mode for details.
java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396) at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:183) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:510) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352) at java.lang.Thread.run(Thread.java:662) Caused by: java.lang.AssertionError at com.google.gwt.user.client.ui.Anchor.wrap(Anchor.java:55) at com.BiddingSystem.client.View.ProductTaxonomyView.(ProductTaxonomyView.java:174) at com.BiddingSystem.client.BiddingSystem.onModuleLoad(BiddingSystem.java:63) ... 9 more