You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Entropy <bl...@gmail.com> on 2018/07/16 19:26:21 UTC

How well does Wicket support multiple tabs for a single session?

Our page designer wants our newest app to open new tabs for each detail
record opened off a list.  Within that tab would be potentially multiple
pages in varying orders related to that record, and then the user might
close it or leave it open, return to the list and move around a few times
(ajax and page loads) before opening other details records and so on...

We've always been a one tab operation with Wicket.  It's pretty stateful,
and I told our designer that I was worried give this statefulness how Wicket
would react to that design.  

Am I being overly cautious?  How will Wicket handle this possible random
moving about.  When one moves from one tab to another and therefore to pages
whose states are different, how does Wicket handle that?  Do I need to
design my pages differently or take any special action?

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How well does Wicket support multiple tabs for a single session?

Posted by Sven Meier <sv...@meiers.net>.
Hi,

Wicket is designed with support for multiple tabs in mind.
Every project I've worked on used this feature intensively.

>showing the same page (albeit different record) in different browser tabs definitely is the design he's pushing for.

Sure, no problem with that. I didn't want to scare you :P

As you know Wicket is a stateful server-side framework. For each rendered page its state has to remain on the server.
Wicket holds a configurable count of old pages around for back-button support. Switching between tabs and working on them alternatively is effectively like returning back to previous pages.

>And what would be the consequences of it being expelled? 

If the page is bookmarkable, you'll just get served a new instance. If not (or this feature is turned in PageSettings#recreateBookmarkablePagesAfterExpiry) then you'll get the infamous PageExpiredErrorPage.

Have fun
Sven

  


Am 19.07.2018 um 17:25 schrieb Entropy:
> I definitely need more info on the 2nd and 3rd items in your list.  My
> designer is bugging me multiple times a day trying to get this answer.  You
> said:
>
>> - you can run into problems when the same page is rendered in two
>> different browser tabs, use AjaxNewWindowNotifyingBehavior to detect this
> What kind of problems are we talking about, and what would I do in that
> behavior to counteract them, because showing the same page (albeit different
> record) in different browser tabs definitely is the design he's pushing for.
>
> - working on different tabs might lead to pages being expelled from the
> page store, see StoreSettings#maxSizePerSession
>
> And what would be the consequences of it being expelled?  User gets an
> error?  Can we close the window in response to that error?  Maybe with a
> message telling them the page expired and they need to re-open it?  Or maybe
> we could re-open it for them?
>
> --
> Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How well does Wicket support multiple tabs for a single session?

Posted by Martin Grigorov <mg...@apache.org>.
Hi,


On Thu, Jul 19, 2018 at 6:25 PM Entropy <bl...@gmail.com> wrote:

> I definitely need more info on the 2nd and 3rd items in your list.  My
> designer is bugging me multiple times a day trying to get this answer.  You
> said:
>
> > - you can run into problems when the same page is rendered in two
> > different browser tabs, use AjaxNewWindowNotifyingBehavior to detect
> this
>
> What kind of problems are we talking about, and what would I do in that
> behavior to counteract them, because showing the same page (albeit
> different
> record) in different browser tabs definitely is the design he's pushing
> for.
>

If you (as a user) try to work with the same page *instance* (i.e. same
page id in the url) in more
than one tabs then you may face StalePageException.
Each page instance has a member field 'renderCount'. Its value is encoded
in the component urls,
e.g. ...?22-1.SomeLink
Here '22' is the page id and '1' is the render count.
If you click this (non-Ajax) link then it will do something in its
#onClick() method and will repaint
the same page instance with its new state (modified in onClick()). The
repainting will increment 'renderCount' to 2.
Now if you try to use page with id 22 in another tab, where the renderCount
is still 1 in the component urls,
Wicket will throw StalePageException, telling you that you try to use old
state of a page.
AjaxNewWindowNotifyingBehavior could help you to detect when the same page
instance is opened in more than one
tabs/windows. The simplest thing you can do is:
setResponsePage(getPageClass(), getPageParameters()).
This effectively will render a new instance of the current page, i.e. it
will have its own page id (like 23) and its own renderCount.
Beware that this will solve the issue with StalePageException but may move
it to your business layer.
For example if the link above removes a record in the DB. Then when you
move to tab2 and try to edit the removed record
your DB layer will fail with something like "No such record error".


>
> - working on different tabs might lead to pages being expelled from the
> page store, see StoreSettings#maxSizePerSession
>
> And what would be the consequences of it being expelled?  User gets an
> error?  Can we close the window in response to that error?  Maybe with a
> message telling them the page expired and they need to re-open it?  Or
> maybe
> we could re-open it for them?
>
> --
> Sent from:
> http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: How well does Wicket support multiple tabs for a single session?

Posted by Entropy <bl...@gmail.com>.
I definitely need more info on the 2nd and 3rd items in your list.  My
designer is bugging me multiple times a day trying to get this answer.  You
said:

> - you can run into problems when the same page is rendered in two 
> different browser tabs, use AjaxNewWindowNotifyingBehavior to detect this 

What kind of problems are we talking about, and what would I do in that
behavior to counteract them, because showing the same page (albeit different
record) in different browser tabs definitely is the design he's pushing for.

- working on different tabs might lead to pages being expelled from the 
page store, see StoreSettings#maxSizePerSession 

And what would be the consequences of it being expelled?  User gets an
error?  Can we close the window in response to that error?  Maybe with a
message telling them the page expired and they need to re-open it?  Or maybe
we could re-open it for them?

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How well does Wicket support multiple tabs for a single session?

Posted by Entropy <bl...@gmail.com>.
Thanks Sven,

Multi-threading should be easy enough.  But thanks for the heads up.

Same page in different browser tabs though absolutely is part of the design. 
What would I *do* in reaction to being notified by that behavior that a new
window is opening?  And what kinds of problems would I expect?

What is the default maxSizePerSession, and what is the consequence of
something being removed.  Let's say i opened record 72 in a tab and then
worked in other tabs for a long time and 72 got expelled.  when I returned
to 72, would it get an error?  Or re-initialize as if they just loaded the
record?  Or could I get an event that it was being removed and tell the user
that it's stale and close that tab?

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How well does Wicket support multiple tabs for a single session?

Posted by Sven Meier <sv...@meiers.net>.
Hi,

each Wicket page is identified by a unique number, so it's no problem to 
open different pages in different browser tabs.

There are some things to consider though:
- be careful if your pages work on state in the session, as this has to 
be designed for multi-threading (something you won't have to bother with 
when you're staying inside a page)
- you can run into problems when the same page is rendered in two 
different browser tabs, use AjaxNewWindowNotifyingBehavior to detect this
- working on different tabs might lead to pages being expelled from the 
page store, see StoreSettings#maxSizePerSession

Have fun
Sven


Am 16.07.2018 um 21:26 schrieb Entropy:
> Our page designer wants our newest app to open new tabs for each detail
> record opened off a list.  Within that tab would be potentially multiple
> pages in varying orders related to that record, and then the user might
> close it or leave it open, return to the list and move around a few times
> (ajax and page loads) before opening other details records and so on...
>
> We've always been a one tab operation with Wicket.  It's pretty stateful,
> and I told our designer that I was worried give this statefulness how Wicket
> would react to that design.
>
> Am I being overly cautious?  How will Wicket handle this possible random
> moving about.  When one moves from one tab to another and therefore to pages
> whose states are different, how does Wicket handle that?  Do I need to
> design my pages differently or take any special action?
>
> --
> Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org