GWT in a JSP file

405 views
Skip to first unread message

Romain

unread,
Nov 9, 2007, 4:46:05 AM11/9/07
to Google Web Toolkit
Hello,
someone have a project using a simple JSP containing a module GWT
(A call for GWT from a JSP)?
"Google Web Toolkit "
If you have a sample project could send me via e-mail.
Thanks

Sumit Chandel

unread,
Nov 12, 2007, 4:12:40 PM11/12/07
to Google-We...@googlegroups.com
Hi Romain,

What you may find useful is the RootPanel.get("elementId").add(new MyGWTComponent()) feature, which allows your GWT components to load in an element specified in your host JSP page. For example, suppose I created a Calendar component using GWT that I wanted to include in one of my JSP pages and my GWT application bootstrap file was name ca.mycompany.Calendar.nocache.js. In the JSP page, I would include the bootstrap file via a <script> tag:

<script src="ca.mycompany.Calendar.nocache.js"></script>

And I would define a div where I would like my Calendar component to be loaded:

<div id="calendar" />

In my GWT module entry point class onModuleLoad() method, I would make the following call to add my Calendar component to the "calendar" div defined in my host JSP page:

RootPanel.get("calendar").add(new Calendar());

And there you have it, a JSP page containing a GWT module.

Hope that helps,
-Sumit Chandel
Reply all
Reply to author
Forward
0 new messages