Instead of using java.io.* packages, you can use GWTs RequestBuilder class
to achieve the same thing. Only restriction - the static content should be
served from the same domain as your web application.


RequestBuilder request = new RequestBuilder(RequestBuilder.GET, url /*must
be in same domain as your web app*/);

        try {
            request.sendRequest(null, new RequestCallback() {
                public void onResponseReceived(Request request, Response
response) {
                    String content = response.getText();
                    if (response.getStatusCode() != 200) {
                        //handle error
                    }
                    else if (content == null || content.equals("")) {
                        //handle error
                    }
                    else {
                        setStaticContentInHtmlPanel(content);
                    }
                }
                public void onError(Request request, Throwable exception) {
                    // handle error
                }
            });
        }
        catch (RequestException re) {
            //handle error
        }

--Sri


2009/10/24 usmanf <[email protected]>

>
> I am designing a home page for my website using GWT ext (GXT). It
> contains a lot of static contents like news, advert text etc that
> usually goes on the home page.
> Firstly I tried separating the static content into html files and
> reading them using java.io.FileReader to set them on the Panel's
> setHtml(). I realized that GWT SDK does not allow to use java.io.* on
> the client side. The only way I have now is to place the static
> content into hard-coded string values like
>
> Panel panel = new Panel();
> panel.setHtml("<p>News</p><p> news news nes newsnsnwensd nsdnewes</
> p>");
>
> I have got a lot of static content to display on the home page which
> is quite annoying to place in the String. Is there any other way/
> solution around.
>
> thanks
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to