Search code examples
javagwthistorygwt-history

Submit button + GWT History


A good design solution when a form is submitted, what should be the behavior of "back" and then "forward" browser button. Similar question is what should happen when a user logout an application the then click "forward" browser button?

I will be glad to hear some scenarios for the mentioned situations.

Thanks.

Edit - should be good to share and my point of view :-)

My personal opinion is after logout the user should be not able to enter the application without go through the login page. For the submit scenario - after submitted and back browser button , the user should be able to return to the form but with NO containing data.


Solution

  • One common pattern is Post/Redirect/Get. Under that pattern, the result of the post is a bookmarkable (and back/forward navigable) page. The Back button has one of it usual meanings of "I didn't mean to go here, take me back where I was" like hitting ESC in most Windows dialogs, and the Forward button means "I didn't mean to hit the back button, I wanted that page after all." This pattern isn't going to work for everyone; it makes the most sense when each page (including the response to a form submit) represents some conceptual entity that you'd want to bookmark.

    As for the logout scenario, most apps check whether you're logged in no matter what page is specified in the URL, and redirect to the login form if you're not logged in. (You don't have to code that on every page; the check is usually a Valve or something.) A nice feature is to remember where the user was trying to go and take them there upon sucessful login.

    Your question is more about design than technology, so GWT doesn't really change the picture, except to note that the GWT history mechanism is intended to mimic the behavior of static pages connected by links, which the post/redirect/get pattern does also.