Hi For redirection you can use following method: public static native void reDirectPage(String html)/*-{ var text = $wnd.location.href; var index = text.lastIndexOf("/"); var subString = text.substring(0,index+1); var targetString = subString+html; $wnd.location.href = targetString; }-*/;
On Nov 25, 9:23 am, Not Ken Shabby <[EMAIL PROTECTED]> wrote: > The following code was 'hand extracted and modified" from a project I > am working on. Therefore there maybe typos. > There are also references / usages of classes not shown here, but you > do not need them. > > The basic flow is: > 1. In your class which implements "EntryPoint" create an instance of a > Logon panel class (of your own design) --- here mine is called > "MyLogonPanel" > 2. Pass a reference to the Entry Point class ("this") to the Logon > Panel class --- so that later you can call back into this class > 2. Add the logon panel to the "RootPanel" > 3. In the constructor of the Logon Panel - create the necessary UI > components to display a logon message and places to enter UserId and > password. > 4. Call your server code to verify the UserId and Password --- onSucess > () should call back a method in the Entry Point class > --- (here "loggedOn() ) which then removes the Logon Panel from > the Root Panel and replaces it with the main application screen. > > I hope this helps. > > Regards, > > Ken. > > ============================================================================================================== > MyEntryPoint.java : > > public class MyEntryPoint implements EntryPoint > { > MyMainScreen screen; > MyLogonPanel logon; > > public void onModuleLoad() > { > logon = new MyLogonPanel(this); > RootPanel.get().add(logon); > } > > public void loggedOn(MyLogonResult result) > { > RootPanel.get().remove(logon); > screen = new MyMainScreen(result); > RootPanel.get().add(screen); > } > > } > > ======================================================================================================== > MyLogonPanel.java: > > public final class MyLogonPanel extends VerticalPanel > { > final TextBox userIdTB = new TextBox(); > final PasswordTextBox passwordTB = new PasswordTextBox(); > final Label message = new Label("Please enter userid and > password"); > final MyEntryPoint entryPoint; > final VerticalPanel logonBox; > > MyLogonPanel(MyEntryPoint entryPoint) > { > this.entryPoint = entryPoint; > HorizontalPanel hp1 = new HorizontalPanel(); > HorizontalPanel hp2 = new HorizontalPanel(); > > this.add(message); > hp1.add(new Label("UserId:")); > hp1.add(userIdTB); > > hp2.add(new Label("Password:")); > hp2.add(passwordTB); > > this.add(hp1); > this.add(hp2); > Button logonB = new Button("Logon"); > logonB.addClickListener(new LogonClickListener()); > this.add(logonB); > logonBox = this; > } > > private class LogonClickListener implements ClickListener > { > public void onClick(Widget sender) > { > message.setText("--trying to logon--"); > MyRemoteServiceAsync call = MyRemoteService.App.getInstance > (); > > UserId userId = new UserId(userIdTB.getText()); > PassWord password = new PassWord(passwordTB.getText()); > LogonCredentials logonCredentials = new LogonCredentials > (userId, password); > call.logon(logonCredentials, new LogonCallback()); > } > } > > private class LogonCallback implements AsyncCallback > { > public void onFailure(Throwable caught) > { > logonBox.add(new Label("failure of LOGON callback")); > logonBox.add(new Label(caught.toString())); > logonBox.add(new Label("------END------------------")); > } > > public void onSuccess(Object obj) > { > System.out.println("LOGON callback - onSuccess"); > MyLogonResult result = (MyLogonResult) obj; > > if (result.logonFailed()) > { > message.setText(result.getResponseString()); > return; > } > entryPoint.loggedOn(result); > } > > } > > } > > ******************************************************************************************************************************************************* > > On Nov 24, 4:56 am, rajasekhar <[EMAIL PROTECTED]> wrote: > > > I need to redirect to home page.because the problem without > > redirecting is when I refresh the home page it is going to login page > > again .Please let me know how to handle this. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---