A simpler solution with no Ajax call would be:
public class MyProject implements EntryPoint
{
public void onModuleLoad()
{
RootPanel.get().add(new
Label(Dictionary.getDictionary("user").get("name")));
}
}
Ian
http://examples.roughian.com
2009/6/14 markww <[email protected]>
>
> Hi,
>
> This is a general question about GWT and user interfaces. In my
> (limited) use with PHP, the server was responsible for generation of
> most of the 'UI'. Each script would emit some html which the client
> browsers download and render.
>
> If we wanted to write a project only using GWT for the presentation,
> this model changes. As I understand it, now the server will spend less
> time generating text via PHP scripts, because it would just be handing
> out the same static .js files - the .js files are the compiled .js
> app. Once it gets to the client browser, the javascript handles
> building out the entire UI (via all the Widget classes).
>
> If this is true, I wonder if anyone can comment on how it affects
> performance (this is a very general question I know). In a PHP-driven
> site, maybe for a logged-in user section I would have done something
> like this:
>
> echo "<div id='blah' etc etc/>
> <p>Some text</p>
> <p>Welcome back, " . $username . "!!!! </p>
> </div>";
>
> now with GWT, I would have set up a bunch of widget classes, then done
> a separate AJAX call and pull down a JSON representation of the user
> to populate my widget:
>
> public class MyProject implements EntryPoint
> {
> public void onModuleLoad()
> {
> VerticalPanel p1 = new VerticalPanel();
> final Label label = new Label("Loading...");
> p1.add(label);
> RootPanel.get().add(p1);
>
> asyncAjaxCall("http://mysite.com/getUserInfo.php") {
> public void onSuccess(Response response) {
> label.setText(JSONParse.parse(response));
> }
> }
> }
> }
>
> I'm not sure which approach is better for the web application I want
> to write. Preferably I'd like to stick totally with GWT for client-
> side, and use PHP via AJAX to get data from my database to populate
> the UI. But I'm not sure if all the widgets I want to create to make
> an appealing user interface will overburden users' browsers, and
> therefore am better off just using PHP to generate the pages for me.
>
> Thanks for any thoughts
> >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---