gwtp - What is the best practice for open a new page or redirect page in GWT? -
there options open new page or redirect page in gwt, & don't know 1 best?
-option 1: redirect current page new page not opening new tab.
string url = window.location.createurlbuilder().sethash("!search").buildstring(); window.location.assign(url);
-option 2: open new page on new tab.
string url = window.location.createurlbuilder().sethash("!search").buildstring(); window.open(url, "_blank", null);
-option 3: redirect current page new page not opening new tab & retain states of previous page
placerequest request=new placerequest(nametokens.search); placemanager.revealplace(request);
in option 1 & 2, seems system starts reload whole page. option 2, if press back
button reload previous page again.
in option 3, seems not reload whole page (ie if have header won't download header again). therefore, run fast. if click back
button won't reload previous page can still see existing states of previous page.
option 3 quite fast. however, need reset variables in previous page otherwise make thing messy , error-prone.
what best practice open new page or redirect page in gwt? option should use?
option 1
whenever reload page, app has reload well. may happen fast, browser caches code , other static elements, point? gwt used "app": resides within single host page, , changes state based on user instructions.
window.location.assign(url)
used when user leaving application: either because user logged out, or because not logged in yet, , redirect him login page.
option 2
usually, option used when provide link different application/website, , want keep app running.
option 3
in option not "redirect" "pages". show different "views" user. web page (host page) remains same @ times. how gwt supposed work.
Comments
Post a Comment