gwt vs servlets/jsp for dynamically generated content?

928 views
Skip to first unread message

tobermory

unread,
Aug 16, 2006, 1:51:38 PM8/16/06
to Google Web Toolkit
In the 'old' webapp days we would use jsp/servlets to help generate the
html/js content that the user sees. Say a user has a id or a role, and
that different content is produced according to that id or role. Or
maybe a back end config file drives the servlet/jsp, or some other
state of the server side app.

Now I am getting into gwt and I can't see how I can still produce
dynamic content. Two approaches spring to mind.

1 after the initial, static gwt-generated page is downloaded, do an
ajax call and populate/update the dom according to the response. This
is essentially shifting the dynamic generation from the servlet to the
browser, and incurs an extra http trip.

2 write literal jsp markup into the gwt java source code, rename the
generated html to jsp and again use the servlet/jsp engine to insert
the appropriate html content. This seems dicey since I have no idea of
the structure of the 'page' that gwt generates.

Neither seems optimal. Option 1 at least will work but is a huge shift
from the current model.

Or am I missing some other technique entirely?

Opinions appreciated

Stuart

PS: Does the new 1.1 'code injection' concept have anything to do with
this problem??

Adam T

unread,
Aug 16, 2006, 2:46:51 PM8/16/06
to Google Web Toolkit
I believe GWT developers need to think more in terms of Desktop
application developers, i.e. things are going to happen at the client
side, than the every click generates a new screen approach (no
criticism of your point!!!).

Yet we can also access benefits that a desktop developer can't, it is
possible to get a new "application" quite quickly and so reduce the
amount of code needed for the application for all users.

The point, I think, is that you can have a hybrid approach to suit your
needs. If your application has a log-in functionality that serves
different views based on roles, then you could have

a) A HTML page with a log-in widget on it
b) when logging in, the server can return a specific UI application for
that role
c) server (or model if you want) code can be generic across the various
UI
d) There is no reason why the UI code can not inherit from a base UI
application to provide consistency/maintainability across the UI
applications, if you wish.

Other types of dynamic content I can think of are

a) lists of data values from databases, in which case you can use
either RPC or HTTPRequest to "pageniate" that data access through some
model either on the server or client side.

b) HTML pages (or generated from JSPs/ASPs/PHP) etc, which again can be
accessed via HTTPRequest object and displayed in an appropriate panel.

Just some thoughts! I think it is going to be really interesting to
see how GWT applications develop.

Reply all
Reply to author
Forward
0 new messages