GWT中的多个入口点 [英] Multiple Entry Points in GWT

查看:133
本文介绍了GWT中的多个入口点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Google Web Toolkit,并对GWT中的入口点感到困惑。 Google的文档说:
$ b


如果在模块中有多个EntryPoint(定义onModuleLoad()的接口),它们将全部被调用只要该模块(和外部文档)准备好就立即进行排序。
如果您要在同一页面中加载多个GWT模块,则只要该模块和外部文档已准备就绪,将立即调用每个模块的EntryPoint。不保证两个模块的EntryPoints同时触发,或者按照在主页中指定其选择脚本的顺序触发。

那么你的网站上的每个页面都需要为它定义一个入口点吗?

当你根据你的javascript生成javascript时,你真的只需要一个入口点Java类?



您能够将多个自动生成的js定义合并为一个* .gwt.xml文件吗?



编辑:引用来源的链接: http://code.google .com / webtoolkit / doc / 1.6 / DevGuideOrganizingProjects.html



谢谢!

解决方案

制作GWT应用程序最直接的方法是为整个应用程序提供一个页面,并且一个顶级 module (定义在 .gwt.xml文件)。每个模块都有一个 EntryPoint 类。然后,所有不同的页面都是同一页面的子部分,理想情况下使用GWT的历史记录机制来跟踪非AJAX Web应用程序中新状态的状态更改。所以,如果你用这种方式设置,你将需要一个入口点为你的整个应用程序。



你引用的文档(链接?)讨论我的想法是一种高级用例,您可以在单个页面上加载多个模块。


I'm getting into Google Web Toolkit, and am a little confused about the Entry Points in GWT. Google's docs say:

If you have multiple EntryPoints (the interface that defines onModuleLoad()) within a module, they will all be called in sequence as soon as that module (and the outer document) is ready. If you are loading multiple GWT modules within the same page, each module's EntryPoint will be called as soon as both that module and the outer document is ready. Two modules' EntryPoints are not guaranteed to fire at the same time, or in the same order in which their selection scripts were specified in the host page.

So does each page in your website need an Entry Point defined for it?

Do you only really NEED an entry point when you have javascript generated based on your Java classes?

Are you able to combine multiple auto-generated-js definitions into a single *.gwt.xml file?

EDIT: Link to quoted source: http://code.google.com/webtoolkit/doc/1.6/DevGuideOrganizingProjects.html

Thanks!

解决方案

The most straightforward way to make a GWT app is to have a single page for the entire application, and a single top-level module (defined in a .gwt.xml file). Each module has a single EntryPoint class. Then all of your different "pages" are sub-sections of the same page, ideally using GWT's history mechanism to keep track of state changes that in a non-AJAX web app would be new pages. So if you set things up this way you'll need one EntryPoint for your whole app.

The bit of the docs that you quoted (link?) discuss what I think is an advanced use case, where you've got more than one module that you're loading on a single page.

这篇关于GWT中的多个入口点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆