如何在 GWT 中获取不同页面的静态 URL 链接
我想构建一个多页面网站,并且需要一种方法来引用另一个 GWT 页面(面板),如何才能使链接是静态的?
I want to build a multi page website and I need a way to refer to another GWT page (panel) how can I do it such that the links are static?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的问题涉及三个问题:
如何指定gwt页面的url。
如何确保 url 是静态的。
如何创建从另一个 gwt 页面到该 gwt 页面的链接。
GWT url 受模块名称和包命名空间影响,并且可以通过 rename-to 属性进行修改。比如说,GWT模块描述文件名为whatever.gwt.xml;以及放置在包命名空间 Zoom.wonderful.world 中的任何模块。该模块的 url 为 http://hostnamespace:port/zoom.wonderful.world.whatever。但您可以使用 rename-to 属性来更改它,url 将是 http://hostnamespace:port/holycow。
但是...你的模块无法通过 url 访问,除非你有一个入口点 - 即实现 EntryPoint 的 gwt java 文件。
您可以在一个模块中拥有多个入口点,但在大多数情况下,我认为您不应该这样做,除非您希望开始从事最混乱的 GWT 代码竞赛。模块中所有入口点的 ui 表示都会重叠。如果继承入口点,则会出现类似的混淆重叠效果。
我心里一直在问你为什么故意问“静态url”,因为模块入口点的url确实是静态的。
然后在您的其他“gwt 页面”中,您只需列出所有“gwt 页面”的“静态网址”
- 在托管 html 文件中(启动模块 javascript 编译的文件)
- 或者,在允许包含 url 链接或 html 代码的 gwt 小部件中。
http://h2g2java.blessedgeek.com/2011/02/uibinder-check -list.html
There are three issues in your questions:
how to specify the url of a gwt page.
how to ensure that url is static.
how to create a link to that gwt page from another gwt page.
A GWT url is effected by the module name and package namespace and can be modified by the rename-to attribute. Say, the GWT module description file is named whatever.gwt.xml; and whatever module is placed at package namespace zoom.wonderful.world . The url of the module would be http ://hostnamespace:port/zoom.wonderful.world.whatever. But you can use the rename-to attribute to change it , the url would be http ://hostnamespace:port/holycow.
But ... your module is not accessible by url unless you have an entrypoint - i.e. a gwt java file that implements EntryPoint.
You can have more than one entry point in a module, but under most circumstances my opinion says that you should not unless you wish to begin a career into the most confusgated GWT code contest. The ui representations of all the entry points in a module would overlap. A similar confusgating overlap effect is available if you inherit an entry point.
Behind my mind, I keep asking why you deliberately ask "static url", because the url of the entry point of a module is indeed static.
Then in your other "gwt page", you merely include list the "static urls" of all the "gwt pages" either
- in the hosting html file (which launches the module javascript-compiled files)
- or, within a gwt widget that allows url links or html code to be included.
http://h2g2java.blessedgeek.com/2011/02/uibinder-check-list.html