How to change URL within GWT app
I'm working with a gwt multipage project which I used these code to switch between html pages, for this case switching from index.html to signup.html page:
public static native void fireChangePage(String url)/*-{
$wnd.location.href = url;
}-*/;
public void goToSignUpPage(boolean isDeployed) {
String url = (isDeployed == true ? "signup.html" : "signup.html?gwt.codesvr=127.0.0.1:9997");
fireChangePage(url);
}
I'm getting error 404 when fireChangePage
is called from the EntryPoint for the index.html.
Manually changing the url on the browser say: index.html?gwt.codesvr=127.0.0.1:9997 to signup.html?gwt.codesvr=127.0.0.1:9997 works, so I can say that the problem is with the native function fireChangePage
.
What could be the problem with the native function? Or is there a better approach than开发者_Go百科 this?
If it's GWT project, you should switch between places (using PlaceController) instead of switching between HTML pages . Anyway, if you have to do so, I'd recommend to use com.google.gwt.user.client.Window.Location
class instead (it's provided by framework and works fine).
Try adding slash to the path of the document, i.e. /signup.html
.
精彩评论