best practice request for handling html content

6 views
Skip to first unread message

sarikan

unread,
Feb 23, 2008, 12:12:33 PM2/23/08
to Google Web Toolkit
Hi there,
I have an up and running gwt app, and now the requirement for
providing a couple of html pages have appeared. The pages have links
to each other, it is basically a set of static pages linked to each
other.
The problem is, at the moment my app alredy has a navigation system
that provides a single page app, and navigation is done via history
change listener. In other words the skeleton of the app is built on
gwt, and inserting html content into this skeleton causes a few
problems, based on the options I can use.

If I use a HTML control, all the site is downloaded at once, which is
not a nice thing due to performance issues.

If I use an IFrame that contains single html pages, this is a solution
to an extend, but Iframe seems to be problematic, since I want its
size (its height actually) to change based on the html content, and
this does not look possible, or let's say it is not possible in a
direct and esay way

Finally, I've implemented a quick solution, where I pull the contents
from server using gwt rpc, and insert into a html control, but when
pages have links to each other, those links have to handled in a
different manner, so that new pages are fetched with rpc. this forces
me to mix navigation functionality into static html pages which is
plain ugly.

so, am I missing an obvious solution here? In general would it be
possible to use gwt as the main framework and insert other sources of
content like plain html or even jsp pages as "components" This is
quite the opposite of of usual approach, where you build gwt
components and embed into asp.net, jsp etc..

All the best
Seref Arikan

k-e-n

unread,
Feb 24, 2008, 11:23:01 AM2/24/08
to Google Web Toolkit
Strictly speaking (in the Computer Science sense) the HTML pages you
mention are not static.
They exhibit 'behavior', i.e. the links provide the user the
opportunity to take some action.
If you wish to reuse the 'content' (the 'static' parts) of your HTML
pages and have them 'under control' of GWT, you must modify them to
'navigate' using GWT.
If you are not allowed to change the original HTML files, you could
make the changes 'on the fly' by searching for links and replacing the
links at runtime.

I would suggest that you never mix JSP into GWT in a naive fashion.
Obviously (to an even greater extent than 'plain' HTML) JSP will cause
you even greater problems in 'controlling' the application.

If you must reuse JSP then a possibly workable approach (if the JSP
produces static HTML) would be to capture the resulting HTML and then
treat it as above.
However, overall it is probably best not to mix these two
technologies. If you are allowed to, and have the time & patients I
would suggest porting the JSP to GWT.

sarikan

unread,
Feb 24, 2008, 11:58:48 AM2/24/08
to Google Web Toolkit
Hi,
There appears to be various requirements which are hard to satisfy
with gwt at the moment, maybe it is not that hard, but for example,
how do you open an excel file, that is generated on the run at the
server when a link is clicked? This is quite straightforward in many
server side technologies (jsp, asp.net jsf etc), but for gwt this
looks hard at the moment.
The maturity of various existing technologies is another
consideration, in case you need web based charting, reporting etc,
there are many existing solutions, but gwt does not contain
alternatives to these solutions at the moment.
I'm not happy about being have to mix gwt to other techs, but my
future requirements seem to be growing, and it is underlined in many
places that gwt is designed to be integrated into other technologies.
I'd like to hear your opinion about this, since your response gave me
the impression that you are not that keen about integration with other
technologies.

All the best
Seref

k-e-n

unread,
Feb 24, 2008, 2:56:37 PM2/24/08
to Google Web Toolkit
It is not impossible, nor even difficult to integrate GWT with other
technologies, nor am I against it.

However, it is not advisable to mix multiple/conflicting control
mechanisms in any application.

There are some specific notes about GWT integration towards the end of
this post.
Web frameworks provide two main functionalities:
1. Retrieval and display of data from a remote source
2. Control / flow of the application control

While it is quite legitimate to have multiple mechanisms for
retrieving and displaying data, which is I think the most basic
problem you are facing (display excel spreadsheets, or various other
generated data), it is not a good idea to have multiple forms of
control within your application.

It would be rather like having a large car in which you can transport
all sorts of different things, but you would not want to have two
people trying to driving the car at the same time.

And you are correct, GWT is a younger technology than say JSP and
there may not be 'out of the box' code for displaying all of the
different data formats that you require nor coverage of integration
with all other useful technologies.

Currently GWT is mostly a programmer's toolkit; if the solutions are
not there you are expected to create your own using GWT as the base of
those solutions.
However, many people have already done this, so there are already
quite a few 'extension-libraries' (see below.)

The library G4JSF which seems to offer GWT and JSF integration appears
not to be an active project. The most recent version I could find was
from Jan 2007, over 12 months old.
The article covering G4JSF mentions only using GWT as a library of UI
components, not as an RPC or integration mechanism, thus I would
gather the library was (attempting) only to use the 'client' side of
GWT.
There are references to the 'current' G4JSF project website being
moved to a couple of different places, but following the prescribed
links I found no trace of G4JSF.

-----------------------------------------------------------------------------------------------------------------------------------------

GWT INTEGRATION / EXTENSION:

There are various extension & integration techniques available for
GWT.

Perhaps the most obvious is that you can generate HTML and drop it
into a GWT widget, however, the HTML should be considered only as a
technique for containing & formatting the data, the HTML should not
contain links to other HTML otherwise you will lose control of the
application.

You can create new 'widgets' (client objects), which can exhibit both
'presentation' and 'behavior', by extending or combining existing GWT
widgets, you can also do this by implementing a 'native JavaScript'
method. These techniques are covered in the standard GWT
documentation.

In addition there are various and a growing number of freely available
GWT extension libraries.

GWT - Spring integration:
http://gwt-widget.sourceforge.net/
The above website has both a server library (SL) which covers Spring
integration and a widget library (WL) which contains a number of
useful widgets, in particular allowing the use of SVG within GWT.

GWT - Hibernate integration:
http://hibernate4gwt.sourceforge.net/

Useful widgets and examples of implementing 'native JavaScript'
methods:
http://gwt.components.googlepages.com/

Extensive and sophisticated UI components:
http://gwt-ext.com/

Other useful widgets
http://www.asquare.net/gwttk/

One other suggestion, if you need integration with other technologies,
search for integration between them and Java rather than between them
and GWT.
Since GWT calls Java on the server-side you can build your integration
from there.

For example there are Java / Excel integrations provided by:

http://www.jxcell.net/
I have not used the above software; it offers Java to Excel connection
& a Swing Excel 'look-alike'

http://poi.apache.org/
The above library I have used & it works well (this was in a pre-GWT
project).
The library gives access to many file types produced by Microsoft
products.

http://www.rgagnon.com/javadetails/java-0516.html
This lists many other Java/Excel options, one of which allows SQL to
be used to read Excel as if it were a database (I have not used this
and cannot comment on its usability, but it sounds like an interesting
idea.)

I hope this helps.
Reply all
Reply to author
Forward
0 new messages