• Post Reply Bookmark Topic Watch Topic
  • New Topic

opneing the same aplication in diferent tabs

 
Camilo Diaz
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Guys:

I was wondering how can i open diferent sessions of the same application on the same browser?

It is possible ??

I'm using tomcat 6, jsf 2.0 and spring
 
Tim Holloway
Bartender
Posts: 18412
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The common way to track user sessions is by the use of cookies. Cookies are shared between all windows and all tabs of a given executing copy of Firefox or IE, although not between Firefox and IE (or any other browse, for that matter).

The only way to have a browser maintaining multiple sessions would be to disable the cookie-based session tracking and use URL rewriting (such as the "jsessionid" option).

However, since one window/tab looks pretty much like another, that's likely to confuse users.
 
Ad Tan
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm in sort of the same problem here...

Seems to me that using a backing bean (of session scope) is a very popular way of JSF development. Many examples are based in this method. Let's revisit the following actions in a classic CRUD use-case using this method:

1. Enter a listing page in tab A
2. Open a new tab B and enter the same listing page
3. Select tab A and edit a record X (which opens a form)
4. Select tab B and edit a different record Y (which opens a form)
5. Make changes on tab A and commit

By step 4, the backing bean is already referencing POJO of record Y, and making changes on tab A is based on record Y and not record X as initially loaded.

I was wondering how is this scenario typically handled, any ideas???

Ad
 
Tim Holloway
Bartender
Posts: 18412
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the answer to your question is "badly". The static declaration of backing beans with fixed identifiers works against the idea of keeping a different edit session in different views. And as a prominent member of the "let's open another tab" crown, I'm disappointed.

You can probably get away with it if you use Request-scope backing beans, but Request scope doesn't work well with postbacks. Possibly the JSF2 View scope can handle it. It depends on whether the View items are uniquely qualified per-view or if they only expect one View to be open at a time, and for that, I'd have to RTFM.
 
Ad Tan
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well.. if I could do the application all over again, then i'd prob think to something better from ground up. Too bad this project is nearing it's end.

Tentatively, I have resorted to using a hidden input initialised with the correct POJO's id. In the backing bean I'll do swapping if the submitted form does not have the same id as the current POJO. Not sure of any drawbacks... needs to test further.
 
Ryan Slominski
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sounds like you are interested in ConversationScope? JSF 1.x with Seam 2.x has it and JSF 2.x with CDI has it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!