How can I use gwt for my project

2 views
Skip to first unread message

seawave

unread,
Mar 3, 2009, 8:24:11 PM3/3/09
to Google Web Toolkit
My project has completed a few days ago,but I don't satisfied about
the web pages.So I want to use gwt to let the pages more beautiful.But
I find I just can use in one page,GWT just have one Entry-point.I hava
a lot of pages,I want to let every page have one Entry-point,what
should I do?
我最近做的一个项目已经基本完工了,我对我的页面展示效果不太满意,所以我决定采用gwt来改善我的页面外观,但是我发现Main.gwt.xml文件
只能对应一个Entry-point,这意味着我只能用一个页面,我这里有好多个页面,每个页面的内容是不同的,我想问下,这是不是需要多个处理类的多
个onModuel()方法呢?

Charlie Collins

unread,
Mar 4, 2009, 8:18:22 AM3/4/09
to Google Web Toolkit
Though you can do one entry point per page, that is sort of missing
the point.

If your project is completed, then don't try to just use GWT to make
it more "beautiful." GWT is about a different approach, about Ajax so
that you really have a single *page* that can handle the entire web
based application and updates the views as needed - it's Ajax (it's
more than that of course, it's Ajax from statically compiled Java,
that generates the JavaScript for you, and gives you all the tooling
and testing that brings, but I digress).

You can also just sprinkle in widgets here and there, one on a page,
that is possible, so don't get me wrong, but that is still not the
real focus of GWT. There are actually other Ajax toolkits that may be
better suited to just making things more "beautiful" on an existing
site by plugging in a widget here or there.

Jason Essington

unread,
Mar 4, 2009, 6:32:38 PM3/4/09
to Google-We...@googlegroups.com
In your specific case it sounds like you want to make certain items on
your pages dynamic.

That can be doe with GWT using either a singe or multiple entry points.

You would still use one main module that is a monolithic compilation
of all of your dynamic parts. Include the <script> tag for that module
in all of your pages and away you go.

The idea is to first identify each item you would like to make
dynamic. A particular input element that suggests the contents
(suggest box) for instance. give that element on the page a specific
ID, and build a GWT module to implement the functionality. do the same
for all of the elements you might use throughout your site.

your entry points should attempt to find the id of component it is
going to populate, and if it isn't found on the page, just exit
immediately (remember you'll have a monolithic library that has all of
your different widgets (components) in it, so some pages may not use
all of the widgets in your module.)

The reason for doing it this way is to allow the most efficient code
sharing. one monolithic module will be considerably smaller than
individual modules for each component. The other benefit is that if
your server is properly configured to set the cache-control headers
for the xxx.cache.xxx files then the javascript payload and image
bundles will be loaded exactly ONCE for your entire site over the life
of a particular version of your application. It is a very efficient
way to make dynamic components that are used throughout a multi page
web site.

-jason
Reply all
Reply to author
Forward
0 new messages