Thanks for the reply.
So it means that it is going to be a GET request from the client to
the server for the resource once the client will load on the browser.
I am thinking to place most of the design code [html] in the static
files with .html and place their contents into the panel's setHtml()
instead of writing GWT code for every thing. like for example I have a
panel in the top that contains anchors like Home, Support, News etc.
Instead of creating a Hyperlink object for each link and setting the
style element to format it, I am thinking to read this chunk of code
from a html file [now use RequestBuilder] and use the panels's setHtml
(String) to display it. The benefit I can see with this approach is
avoid compiling the code even for a small change and also it could be
easy to change in the future.
Am I thinking in the right direction?



On Oct 25, 3:33 am, Sripathi Krishnan <[email protected]>
wrote:
> 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