How can I embed a webpage in a GWT/GXT webapp?

拟墨画扇 提交于 2020-01-02 11:59:06

问题


I am working to recreate (conceptually) a prototype I've written in Cappuccino in GWT/GXT. Cappuccino made it trivial to display an external webpage as part of the application by using a WebView.

However, I cannot find any way to do this with GWT/GXT. There is a HtmlContainer widget, but this seems to be intended for something else. Any suggestions on how to do this?


回答1:


You can set the url of a ContentPanel

e.g.

ContentPanel panel = new ContentPanel();
panel.setUrl("http://www.url.com/page");
panel.setHeaderVisible(false);
panel.setBorders(false);
panel.setBodyBorder(false);

You can also do this for the GXT Window class too.




回答2:


If you have the html-code and just want to render it use the "HTML"-widget. Form the docs

A widget that can contain arbitrary HTML. This widget uses a element, causing it to be displayed with block layout.

If you want to display a different page e.g. stackoverflow.com in your webapp use the "frame" widget. From the docs:

A widget that wraps an IFRAME element, which can contain an arbitrary web site.



来源:https://stackoverflow.com/questions/2185386/how-can-i-embed-a-webpage-in-a-gwt-gxt-webapp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!