Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Myfaces Wiki" for change notification.
The "Drafts/WindowId" page has been changed by GerhardPetracek:http://wiki.apache.org/myfaces/Drafts/WindowId?action=diff&rev1=7&rev2=8
= intro =
- here we collect ideas for [[http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-949]]
+ here we collect ideas for [[http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-949]] btw. [[JAVASERVERFACES_SPEC_PUBLIC-949 Window-id]]
+ this site contains:
+ * possible approaches to detect a window based on different kind of IDs
+ * possibilities for closing logical windows (represented by an ID) and opening new logical windows manually
+ this site doesn't include:
+ * information for a concrete scope
+ the result can be used for:
+ * window distinction
+ * state (including custom-scope) history per window -> back button support
+ * double submit prevention
= new apis =
@@ -42, +54 @@
= DRAFT: Discussion .... =
+ Some libraries like Trinidad (ADF Faces), Icefaces, MyFaces CODI and others usually provide some partial hacks to deal with such use cases. Only the client-side window-handler is a completely working solution with the drawbacks of page-flickering and the incompatibility with libs like PrettyFaces.
- It is frequent to find questions about how to create multi-window web applications with JSF. Prove of that are the following list of issues sent
- to MyFaces issue tracker (https://issues.apache.org/jira/browse/MYFACES):
+ Known solutions for storing the window-id on the client-side (which doesn't support all use-cases on the client-side):
- * MYFACES-32 Multiple browser window problem with server state saving
- * MYFACES-1206 JSR-252 Issue #11: Provide a unique window identifier to accomodate applications that have multiple instances of the same view,
- but perhaps in different browser windows or frames.
- * MYFACES-1791 state management and multiple frames
- * MYFACES-3100 Repeated postbacks create additional serialized views
- * MYFACES-3117 Current server state saving implementation prevents multi-window usage
- On http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC
- * JAVASERVERFACES_SPEC_PUBLIC-11 Frames: StateSaving: unique window id for each view
- * JAVASERVERFACES_SPEC_PUBLIC-949 Window-id
+ 1. Hidden field
+ No support for GET requests
+ 2. Cookie only
+ Doesn't work at all
+ 3. Cookie which gets set via js directly before the request (request-id is stored in the url + a request-id in window.name)
+ Also supports GET requests -- possible problem (depending on the browser): parallel windows which poll frequently; additional mouse buttons e.g. binding of the middle mouse button)
+ 4. URL only
+ Clones a window with "open in new tab" and similar
+ 5. URL + request-id in a hidden field for POST requests and
+ 6. sessionStorage of HTML5
+ Looks promising with Firefox but not with other browsers
- On http://java.net/jira/browse/JAVASERVERFACES
+ == Misc ==
- * JAVASERVERFACES-121 Store Session States on a per window and viewid basis
+ == Further readings ==
- The first intention to understand the problem and implement something on MyFaces was done by Mario Ivankovits on this article:
+ * [[http://java.net/jira/browse/JAVASERVERFACES-121]]
+ * [[http://myfaces.apache.org/orchestra/myfaces-orchestra-core/multiwindow.html]]
+ * [[http://markmail.org/message/7yrh7267lr5jauua?q=[core]+Enhancements+to+State+Saving+Caching+Algorithm ]]
+ == Other Frameworks ==
- More recently, there was some discussions and other additional steps to understand this better :
+ Frameworks like Stripes has a Flash Scope that support multiple windows using a query param.
- Some libraries like Trinidad (ADF Faces), Icefaces, MyFaces CODI and others usually provide some partial hacks to deal with such use cases.
- Unfortunately, any of those hacks have side effects, because each one could implement a variant of the known solutions:
- 1. Embedding a window-id in a hidden field
- 2. Embedding a window-id in a cookie
- 3. Embedding a window-id in the URL
- To keep things simple, from MyFaces Core (or JSF Impl) point of view it this concept is relevant because:
- * Instead rely on such specific hacks, it could be good to have a simple way to identify a window, so other libraries can just use it.
- * It could make possible to implement WindowScope on top of this (using the windowId as a key for retrieve the scope relative values).
- * State handling mechanics could use it to identify a view with the same name. That could make possible things like remove other views
- coming from the same window and prevent "double button" or "back button" problem from server side.
- Frameworks like Stripes has a Flash Scope that support multiple windows using a query param. MyFaces Core Flash scope uses a Cookie, so in a
- multi-window app it will not work correctly.
- Common use cases:
+ == Common use cases ==
1. Use target="_blank"