This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes JSF and the fly likes opneing the same aplication in diferent tabs Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "opneing the same aplication in diferent tabs" Watch "opneing the same aplication in diferent tabs" New topic
Author

opneing the same aplication in diferent tabs

Camilo Diaz
Greenhorn

Joined: Sep 03, 2009
Posts: 19
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
Saloon Keeper

Joined: Jun 25, 2001
Posts: 14466
    
    7

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Ad Tan
Greenhorn

Joined: Oct 30, 2009
Posts: 22
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
Saloon Keeper

Joined: Jun 25, 2001
Posts: 14466
    
    7

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

Joined: Oct 30, 2009
Posts: 22
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

Joined: Nov 05, 2010
Posts: 33
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: opneing the same aplication in diferent tabs
 
Similar Threads
Can I have j_security_check in two login.jsp
Inner Class definition per JLS
RMI over JRMP
is the 141 sample test always the same?
Collaboration Diagram x Sequence Diagram