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

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

问题描述

我正在使用 Google Web Toolkit,并且对 GWT 中的入口点有点困惑.Google 的文档说:

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

如果在一个模块中有多个 EntryPoints(定义 onModuleLoad() 的接口),一旦该模块(和外部文档)准备好,它们都会被依次调用.如果您在同一页面中加载多个 GWT 模块,则一旦该模块和外部文档都准备就绪,就会调用每个模块的 EntryPoint.不能保证两个模块的 EntryPoint 会同时触发,也不能保证其选择脚本在主机页面中指定的顺序相同.

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?

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

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

您能否将多个自动生成的 js 定义合并到一个 *.gwt.xml 文件中?

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

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

谢谢!

推荐答案

制作 GWT 应用程序最直接的方法是为整个应用程序创建一个页面,以及一个单独的顶级 模块(在.gwt.xml 文件).每个模块都有一个 入口点 类.然后所有不同的页面"都是同一页面的子部分,理想情况下使用 GWT 的历史机制来跟踪状态更改,在非 AJAX 网络应用程序中将是新页面.因此,如果您以这种方式进行设置,您的整个应用程序将需要一个入口点.

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天全站免登陆