Importing HTML files to the page

3 views
Skip to first unread message

Trey

unread,
Dec 22, 2007, 10:55:45 AM12/22/07
to Google Web Toolkit
I have written minimal amounts of code in AJAX and recently decided to
try GWT. All of the examples I see are similar to KitchenSink in that
they include HTML within Java code. I would rather use external HTML
files.

I looked through the documentation and all of the tutorials I could
find but I can't seem to figure out how to do what I need. All I want
is to make an event which loads a division with new HTML (from an
external page although it does not need to be reloaded every time),
loads the proper stylesheets and scripts to go along with this HTML,
and unloads the stylesheets and scripts that correspond to the
previous page.

I had a script set up that I wrote in AjAX and I am surprised that I
can't figure out a way to do this with GWT. I hope this is possible.

Ian Bambury

unread,
Dec 22, 2007, 11:11:29 AM12/22/07
to Google-We...@googlegroups.com
Hi Trey,
 
I offered a framework which has this built in a couple of days ago  (though not the css). If you go to http://www.examples.roughian.com/rxf/#Download and download the jar and have a look at AbstractRemotePage it will show you how I approached it. You could get the css file name in the same way I get the title
 
Ian

 

Robert Hanson

unread,
Dec 23, 2007, 8:55:11 AM12/23/07
to Google-We...@googlegroups.com
I created a widget called HTMLInclude that I have used in a few
things. You can find the source at the link below, just copy into
your project and alter the package name as needed.

http://gwtsandbox.googlecode.com/svn/trunk/projects/ViewportViewer/src/com/gwtsandbox/viewport/client/HTMLInclude.java

Usage:

Widget w = new HTMLInclude("/target/file.html");
RootPanel.get().add(w);


Rob
http://roberthanson.name

mP

unread,
Dec 24, 2007, 2:10:08 AM12/24/07
to Google Web Toolkit
I am sort of part of the way thru thinking and playing with a
generator that lets you slurp in files into String constants within a
class. This way once could include a page without the remote request.

Another idea i was thinking was of providing a templating mechanism
that was in effect the same as what a jsp does but executes on the
client following basic jsp constructs like including values <%= %> and
code snippets <% xxx %>.

Eric Ayers

unread,
Dec 28, 2007, 9:32:23 AM12/28/07
to Google-We...@googlegroups.com
I agree with the sentiment that including raw HTML inside of Java code is kind of awkward, yet I don't want to have to pay for a round trip to the server.  Some sort of deferred binding mechanism to get raw HTML or an HTML template from a plain text file would be great.  Possibly a mechanism like an Image Bundle but for text?




--
Eric Z. Ayers - GWT Team - Atlanta, GA USA
http://code.google.com/webtoolkit/

Eric Ayers

unread,
Dec 31, 2007, 8:23:19 AM12/31/07
to Google-We...@googlegroups.com
I just watched the Deployment talk from the GWT conference.   I think that the ImmutableResourceBundle in the gwt-incubator does the deferred binding part (minus the templating part that mP was talking about.)
Reply all
Reply to author
Forward
0 new messages