GWT多模块单独的HTML页面? [英] GWT multi modules for separate HTML pages?

查看:97
本文介绍了GWT多模块单独的HTML页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于GWT,我很新,并将使用GWT开发用户管理应用程序的UI。
我打算使用使用Spring / Hibernate创建的现有模块。我想出了如何将GWT与Spring集成,但我不知道如何设计布局。



我想要两页:


  1. 用户注册页面(想要嵌入GWT在HTML中)

  2. 管理页面(使用嵌入的GWT窗口部件来分隔HTML)

  3. 我打算使用Spring Security, JSP登录页面还是可以使用RIA GWT登录小部件?

我可以使用什么来满足上述要求?多个GWT模块?

解决方案

您可以创建2个模块,一个用于登录窗口小部件,另一个用于管理窗口小部件。例如,为每个模块创建一个* .gwt.xml,例如,为每个模块创建一个* .gwt.xml文件。例如,为每个模块创建* .gwt.xml文件:login.gwt.xml和admin.gwt.xml。这些文件都应该在你的gwt包的根目录下创建,例如: com.gwt.example



接下来,为每个类创建一个入口点类(每个类将实现 EntryPoint )。例如,Login.java可能如下所示:

  package com.gwt.example.myproject.client; 

public class Login实现EntryPoint {

public void onModuleLoad(){
... create loginWidget ..

RootPanel.get ( 我的登录-DIV)添加(loginWidget);

}

}

所以,现在,当你做一个gwt编译时,它应该在 war / com.gwt.example 下创建一堆文件。您感兴趣的两个是 com.gwt.example.login.nocache.js com.gwt.example.admin.nocache.js 。



现在,您可以根据需要将这两个js脚本添加到任何html和/或jsp页面。



要完成该示例,您可以添加以下html来添加登录小部件:

 < ; HTML> 
....其他内容...
< script type =text / javascriptlanguage =javascriptsrc =com.gwt.example.login.nocache.js><< ; /脚本>
.... other stuff ....
< div id =my-login-widget>< / div>
....其余的html标记....
< / html>

所以,当你浏览到这个html页面时,它会加载已编译的gwt javascript,它知道要加载onModuleLoad ,它使用ID =my-login-widget查找div并插入登录窗口小部件。



我从来没有使用过Spring Security,所以不能太多帮助,除了这篇文章看起来它可能描述了如何使Spring Security的工作超过ajax 。


I am quite new to GWT and going to develop the UI for user-management application using GWT. I am planning to use existing module which created using Spring/Hibernate. I figured out how to integrate GWT with Spring but I am not sure how to design the layout.

I want two pages:

  1. User registration page (want to embedd GWT widget in HTML)
  2. Administration page (seperate HTML as above with GWT widget embedded)
  3. I am planing to use Spring Security,shall I use simple JSP login page or can I use RIA GWT login widget?

What can I use for above requirements? multiple GWT modules?

解决方案

You could make 2 modules, one for the login widget, and another for the admin widget. Each widget will insert itself into a div in whichever html (or jsp) page you want.

For example, create a *.gwt.xml for each module, for example: login.gwt.xml and admin.gwt.xml. These files should both be created at the root of your gwt package, for example: com.gwt.example.

Next, create an "Entry Point" class for each (each class will implement EntryPoint). For example, Login.java might look like:

package com.gwt.example.myproject.client;

public class Login implements EntryPoint {

  public void onModuleLoad() {
    ... create loginWidget ..

    RootPanel.get("my-login-div").add(loginWidget);

  }

}

So, now, when you do a gwt compile, it should create a bunch of files under war/com.gwt.example. The two you're interested in are com.gwt.example.login.nocache.js and com.gwt.example.admin.nocache.js.

Now, you can add these two js scripts into any html and/or jsp page as needed.

To complete the example, you could add the following html to add the login widget:

<html>
....other stuff...
<script type="text/javascript" language="javascript" src="com.gwt.example.login.nocache.js"></script>
....other stuff....
<div id="my-login-widget"></div>
....the rest of your html markup....
</html>

So, when you browse to this html page, it loads compiled gwt javascript, which knows to load onModuleLoad, which looks for div with id="my-login-widget" and inserts the login widget.

I've never used Spring Security, so can't be much help, other than this article looks like it might describe how to make Spring Security work over ajax.

这篇关于GWT多模块单独的HTML页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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