GWT:如何创建新页面 [英] GWT: How to create a new page

查看:32
本文介绍了GWT:如何创建新页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个只有一页的 GWT MVP 应用程序.如何创建新页面并链接到它?

I have a GWT MVP application with one page. How can I create a new page and link to it?

推荐答案

我创建了一个开源的 MIT 许可项目,以简化 GWT 中的页面导航处理.查看 GWT Views 项目.

I created a open source, MIT licensed project to ease the page navigation handling in GWT. Take a look at the GWT Views project.

使用它,您可以使用简单的 Java 注释定义一个视图(一个由唯一 URL 标记引用的小部件).该框架会为您处理代码拆分,并隐藏所有样板代码.

Using it you can define a View (a Widget referenced by an unique URL token) using simple Java annotations. The framework takes care of code-splitting for you, and hides all the boilerplate code.

这是一个例子:

@View(Login.TOKEN)
public class Login extends Composite {
//... your code, you can use UIBinder, procedural UI, whatever you like

当使用 History.newItem(Login.TOKEN) 时,Login 小部件将在页面上呈现.

When using History.newItem(Login.TOKEN) the Login widget will be rendered at the page.

该框架还处理了许多常见用例,例如 ViewContainers、404 页面、Google Analytics 跟踪和用户授权.

There are a lot of common use cases handled by the framework as well, such as ViewContainers, 404 pages, Google Analytics tracking, and user authorization.

这篇关于GWT:如何创建新页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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