How to configure GWT in existing application

43 views
Skip to first unread message

Arul

unread,
Dec 2, 2008, 8:56:48 AM12/2/08
to Google Web Toolkit
Hi,
Want to replace existing presentaion layer alone by GWT.
Current application stores session value in servlet for processing in
JSP.

The same way , How a GWT tool will be used to diplay those values
stored in session(servlet)?


Thanks
Arul

gregor

unread,
Dec 2, 2008, 2:18:15 PM12/2/08
to Google Web Toolkit
Hi Arul,

What are you attempting?

If you want to replace your entire existing Struts/JSP based UI with
GWT in one iteration but retain existing server-side services, then
perhaps the easiest way is to replace your Action classes with GWT RPC
servlet methods and just copy most of your Action.perform(..) code to
these GWT RemoteServiceServlet methods (minus the JSP redirect and
bean binding bits, plus preparing the beans for return to GWT client).
Your application UI would then load and run from a single HTML file
(which is optimal for GWT) and you can throw the old Struts stuff
away.

If on the other hand you want to (or must) either a) embed a bit of
GWT sparkle into individual existing JSPs or b) incrementally replace
JSPs over time, then the situation is more complicated. You need to
explain your constraints and what you need to do.

regards
gregor

GWT Newbie

unread,
Dec 3, 2008, 3:03:35 AM12/3/08
to Google Web Toolkit
Hello,

I am attempting to do a similar integration.
I explain what I try to do here :

http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/173602a0c87bfc02

Can you be of any help ? Thanks

Hieu

gregor

unread,
Dec 3, 2008, 5:51:21 AM12/3/08
to Google Web Toolkit

I'm pretty sure you can't do this:

<a href="/myContext/myRemoteServiceServlet?
param1Name=param1Value&param2Name=param2Value">

I think what you need to do is something like this:

1) Edit your JSP page to link in the GWT app, e.g.

<head>
<title>Some Application</title>
......
......
<meta name='gwt:module' content='com.foo.myapp.MyGWTModule'>
<link rel=stylesheet href="MyGWTModule.css">
......
......
</head>
<body>
......
......
<script language="javascript"
src="com.foo.myapp.MyGWTModule.nocache.js"></script>
<iframe id="__gwt_historyFrame" style="width:0;height:0;border:
0"></iframe>
.......
.......
<DIV id="MyGWTApp">
</DIV>
.......
.......
</body>

2) In onModuleLoad():

RootPanel.get("MyGWTApp").add(aWidget);

3) Use the GWT RPC mechanism from within your GWT module code to fetch
data and populate your GWT widgets as per GWT documentation.

4) You can use more than one id tagged DIV to house different widgets
at different locations within the same JSP page. So you can have a
Tree here and a Grid there for example. Load them from onModuleLoad(),
not the JSP itself.

5) so far so straight forward, but what I do not believe you can do is
to add, say, a GWT Tree to JSP1, and then a GWT Grid to JSP2 from the
same GWT module because a GWT module is basically a javascript file
that gets loaded into a single page. You can do it by using separate
GWT modules for each JSP (the so-called "mini-app" approach), but that
is not always convenient. Therefore you need to have a think about how
you go about this since you may find you can't easily do exactly what
you had in mind.

regards
gregor



On Dec 3, 8:03 am, GWT Newbie <nghieu.tru...@gmail.com> wrote:
> Hello,
>
> I am attempting to do a similar integration.
> I explain what I try to do here :
>
> http://groups.google.com/group/Google-Web-Toolkit/browse_thread/threa...

GWT Newbie

unread,
Dec 3, 2008, 6:35:50 AM12/3/08
to Google Web Toolkit
First of all, thanks for taking time answering :-)

On 3 déc, 11:51, gregor <greg.power...@googlemail.com> wrote:
> I'm pretty sure you can't do this:
>
> <a href="/myContext/myRemoteServiceServlet?
> param1Name=param1Value&param2Name=param2Value">

The differents manip. I did, lead me to the same conclusion.
And I think this is not the right way to do the integration.

> I think what you need to do is something like this:
[...]

I was trying this.

The issue for me now is how to pass the parameters I need from the
external world to the gwt module.

For instance, let's say the is a class ParametersManager which has
setters/getters (set/getName,...) located on the client side of gwt
module.
Is it possible to call it from the jsp in order to set the parameters
needed by the gwt module to deal with the data it will display ?

gregor

unread,
Dec 3, 2008, 8:10:09 AM12/3/08
to Google Web Toolkit

GWT Newbie

unread,
Dec 3, 2008, 10:04:21 AM12/3/08
to Google Web Toolkit
Yes. Looks like that.

I will read it more carefully this night.

Thanks.

On 3 déc, 14:10, gregor <greg.power...@googlemail.com> wrote:
> You mean this sort of thing?
>
> http://groups.google.com/group/Google-Web-Toolkit/browse_thread/threa...
>

GWT Newbie

unread,
Dec 4, 2008, 3:32:00 AM12/4/08
to Google Web Toolkit
The method with JSNI seems to be recommanded.

I was wondering if this one is also acceptable:

1) Take the html file of the module
2) Insert a DIV element with the wanted value to pass to gwt: <DIV
id="div_id" value="div_value"/>
3) Get the value of the DIV element in the onModuleLoad:

com.google.gwt.dom.client.Document doc = RootPanel.getBodyElement
().getOwnerDocument();
Element el = doc.getElementById(div_id);
Object obj = el.getAttribute("value");
Reply all
Reply to author
Forward
0 new messages