As we all know, the GWT page is written in Java code, and there is no HTML page directly acting on the GWT panel. But GWT also provides a number of features available, such as frame, this is a UI, the internal can set the URL, but after I test found that the frame after the build, in the nested panel around a box, the effect of beautiful, specifically can not be modified by CSS, I did not test more. Have time to try it later.
I'm here to illustrate another way, GWT provides an HTML UI that has a method, sethtml (String str). Well, it's almost clear that you put some strings in the HTML UI, and then you can show the HTML on the page. But it is impractical to make all the code of an HTML page into a string. The Clientbundle in GWT provides a way to reference external resources. The detailed code is as follows:
1 ImportCom.google.gwt.core.shared.GWT;2 ImportCom.google.gwt.resources.client.ClientBundle;3 ImportCom.google.gwt.resources.client.TextResource;4 5 Public InterfaceHtmlresourcesextendsClientbundle {6 7 Public Static FinalHtmlresources INSTANCE = Gwt.create (htmlresources.class);8 9@Source ("page.html")Ten PublicTextresource gethtml (); One}
It uses the deferred binding method of Gwt.create (), which binds itself here.
Here's how to use it:
New=HtmlResources.INSTANCE.getHtml (). GetText (); html.sethtml (str); Panel.add (HTML);
The use is also simple, so that the HTML page code into a string.
GWT embeds plain HTML pages