Got this app, if you open it the first time it will check for a value in a DB, if the value is there all is good
If the value is NOT there, I would like to redirect to another page where the user can input this.
How can I do this?
PS: I can access to the other page using the @NameTolen value in the URL. Just don't know how to make an automatic "switch" and in which part of the Presenter layer to code it (if it even goes there).
In your presenter you can check the value in onReveal()
or onReset()
methods. See presenter life cycle: http://code.google.com/p/gwt-platform/wiki/GettingStarted#Presenter_lifecycle
You also need to inject the PlaceManager
in the presenter using the constructor. And then you can redirect like that:
public void onReveal() {
if(checkValue()) {
PlaceRequest myRequest = new PlaceRequest(NameTokens.yourPage);
placeManager.revealPlace(myRequest);
}
}
See Revealing a Presenter: http://code.google.com/p/gwt-platform/wiki/GettingStarted#Revealing_a_presenter