If you want to redirect to any url in your application, you may use the static ContextToolkit.applyRedirect function.

This can be done within controller or view, even though you are encouraged to use it only in the controller.

ContextToolkit.applyRedirect(context, "/hello");

After the execution of the path is finished, the page will redirect to hello.

Mind the preceeding slash. It's necessary because this function just sets the HTML header Location. You may even use absolute url's here:

ContextToolkit.applyRedirect(context, "http://example.org");

Comments