As part of porting a legacy application to GWT, we need to embed our existing JSPs inside of our GWT app. Many of these pages are quite long, resulting in a double scrollbar- one for window of the main app, and a second one for the content of the frame. I'd like to get rid of the internal scrollbar, and just have the normal browser scrollbar on the main window. If I could get the height of the rendered content (the whole scrollable area) I could just set the height on my frame to match this, but I don't see where I would get that information.
EDIT: to clarify, GWT is the main app navigation, and uses iframes (com.google.gwt.user.client.ui.Frame
) to embed the legacy content. What I am trying to do is make the page big enough so that the enclosed frame does not need scrollbars; only the host page will scroll. If there is any way to determine the "scrollable area" of a frame I could dynamically resize the main page to fit it.
2nd EDIT: I ended up more or less following Jack M's suggestion. But instead of using HTTPRequest I used the RequestBuilder, which makes it easy as pie. I wanted to go this route of grabbing the HTML manually rather than using a frame from the beginning, but was stymied by having to "fix up" the URLs in the hosted pages; there are many instances of relative URLs that have to be patched up in order to work if the user "clicks through" the hosted HTML. Making history navigation work with this is also a bit of a pain. Once I clean my code up a bit I will try to post it somewhere where folks can get at it, because I'm sure this must be a common use case for people migrating existing apps to GWT.
May be it makes sense to embed GWT into old JSP? Place <div id="for.gwt"/> somewhere on the JSP, and import JS.
It's not clear how you embed JSP into GWT, sorry.
Would something like document.body.clientHeight within the frame help you, I wonder?
Read this, it will most likely be a solution to your problem
It explains how you can get the size of the window and manage it's scrolling in JavaScript.
The easiest way that I can think of to fully solve this problem is to not use a Frame element, but rather an HTMLPanel combined with an HTTPRequest. This approach adds complexity with the RPC call, but an HTMLPanel is a simple
<div>
that has content within it. As such, it can expand and/or contact with your JSP content. The end result would be a seamless integration of the two pages.Google's own example on JSON has good examples for making an HTTP request.