简体   繁体   English

GWT中的多个入口点

[英]Multiple Entry Points in GWT

I'm getting into Google Web Toolkit, and am a little confused about the Entry Points in GWT. 我正在使用Google Web Toolkit,对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. 如果模块中有多个EntryPoints(定义onModuleLoad()的接口),则只要该模块(和外部文档)准备好,它们就会按顺序调用。 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. 如果要在同一页面中加载多个GWT模块,则只要该模块和外部文档都准备就绪,就会调用每个模块的EntryPoint。 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. 两个模块的EntryPoints不能保证同时触发,或者与主机页面中指定选择脚本的顺序相同。

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? 当你根据Java类生成javascript时,你真的需要一个入口点吗?

Are you able to combine multiple auto-generated-js definitions into a single *.gwt.xml file? 您是否能够将多个自动生成的js定义组合到单个* .gwt.xml文件中?

EDIT: Link to quoted source: http://code.google.com/webtoolkit/doc/1.6/DevGuideOrganizingProjects.html 编辑:链接到引用的来源: 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 ). 制作GWT应用程序最直接的方法是为整个应用程序提供单个页面,以及单个顶级模块 (在.gwt.xml文件中定义)。 Each module has a single EntryPoint class. 每个模块都有一个EntryPoint类。 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. 然后,所有不同的“页面”都是同一页面的子部分,理想情况下使用GWT的历史记录机制来跟踪非AJAX Web应用程序中新状态页面的状态变化。 So if you set things up this way you'll need one EntryPoint for your whole app. 因此,如果您以这种方式设置,您将需要一个EntryPoint用于整个应用程序。

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. 您引用的文档(链接?)讨论了我认为是一个高级用例,您在一个页面上加载了多个模块。

there is one options, U can create maven project with sub projects, means U can create multi entrypoint, 有一个选项,U可以用子项目创建maven项目,意味着U可以创建多个入口点,
each entry point have own html. 每个入口点都有自己的html。 See more details 查看更多详情

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM