Tuesday, May 11, 2010

Re: Unnormal behavior while using native redirect-Methode?

On 10 mai, 16:42, malibubu <webmas...@mailball.de> wrote:
> Hi @all...
>
> I'm calling my EntryPoint using the URLhttp://localhost:8080/testdesk/.
>
> I've implemented the following native Method to redirect to another
> page:
>
>         static native void redirect(String url)
>         /*-{
>                 $wnd.location.replace(url);
>         }-*/;

Note that you can write Window.Location.replace(url) to the same
effect.

> If an Exception occurs within my Methods, I call the native Method
> with the Parameter "./login.jsp" but he tries to open this URL:http://localhost:8080/testdesk/testdesk/login.jsp
>
> What is wrong with the method?

The browser is just resolving the URL reference relative to the URL of
the *calling* browser context (in this case, the <md5>.cache.html,
which is loaded in a hidden iframe).
To fix this you just have to use an "absolute path", which you can
easily construct using GWT.getHostPageBaseURL(). For instance:

Window.Location.replace(GWT.getHostPageBaseURL() + "login.jsp");

--
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 google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate