views:

915

answers:

2

Greetings all,

I am quite new to GWT and going to develop the UI for user-management application using GWT. I am planing to use existing module which created using Spring/Hibernate.I figure 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 ?

Thanks in advacnce.

+4  A: 

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.

Dave Paroulek
thanks . that helped alot!
umanga
+1  A: 

You can create two modules or use only one.

I recently created an application where there was only one page, and the login panel was shown first, like an inner dialog box. When the session expired, the user was prompted to enter his credentials again. But I was going for a 100% no-page-refresh approach. It is nice, but the disadvantage is that the browser will have to download everything upfront. Well… at least until GWT 2.0.

ciczan