[ https://issues.apache.org/jira/browse/MYFACES-3881?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13968186#comment-13968186 ]
Rene O commented on MYFACES-3881: --------------------------------- I have found a workaround for my current usecase: My idea is similar to client mode (javax.faces.CLIENT_WINDOW_MODE -> client), but doesn't use requestparam 'mfRid'. Implementation: - using of deltaspikes @WindowScoped for my beans (@ViewScoped doesn't work here) - using of special viewAction {code:title=web.xml} <context-param> <param-name>javax.faces.CLIENT_WINDOW_MODE</param-name> <param-value>url</param-value> </context-param> {code} {code:title=mypage.xhtml} <f:metadata> <f:viewAction action="#{initCtr.initApplication()}"/> </f:metadata> {code} {code:title=InitCtr.java} public void initApplication(){ FacesContext ctx = FacesContext.getCurrentInstance(); ExternalContext exCtx = ctx.getExternalContext(); String windowid = exCtx.getClientWindow().getId(); System.out.println("windowid: "+windowid); //get current requestparams Map<String,String> reqparams = exCtx.getRequestParameterMap(); //only redirect if no jfwid exists yet or an old unknown jfwid is used within the browser if(!reqparams.containsKey("jfwid") || !windowid.equals(reqparams.get("jfwid"))){ try { StringBuilder sb = new StringBuilder(); sb.append("?"); //append all requestparams for (Map.Entry<String,String> entry : reqparams.entrySet()) { sb.append(entry.getKey()).append("=").append(entry.getValue()).append("&"); } //append jfwid to be able to decide if a new 'windowsession' is needed or not sb.append("jfwid=").append(exCtx.getClientWindow().getId()); //redirect to same page with new added jfwid param exCtx.redirect(exCtx.getRequestContextPath()+exCtx.getRequestServletPath()+sb.toString()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } {code} A new showcase (jsftest22_new.zip) is attached: http://localhost:8080/jsftest22/mypage.jsf > CLIENT_WINDOW_MODE generates new windowid even if one exists > ------------------------------------------------------------ > > Key: MYFACES-3881 > URL: https://issues.apache.org/jira/browse/MYFACES-3881 > Project: MyFaces Core > Issue Type: Bug > Affects Versions: 2.2.2 > Environment: java 7, tomcat 7.0.50 > Reporter: Rene O > Attachments: jsftest22.zip, jsftest22_new.zip > > > If you use @ViewScoped beans and activate CLIENT_WINDOW_MODE (url or client) > a page refresh generates a new windowid although the application in the > current browser window already has a windowid. > I think a new windowid should only be generated, if no windowid exists, e.g. > open new window or tab with the same url. > <context-param> > <param-name>javax.faces.CLIENT_WINDOW_MODE</param-name> > <param-value>url</param-value> > <!--client doesn't work too--> > </context-param> > A testcase is attached. > call url: http://localhost:8080/jsftest22/mypage.jsf > Fill some values into field > Press F5 to refresh the page > => new windowid is generated => inputdata is lost, because a new @ViewScoped > bean was created -- This message was sent by Atlassian JIRA (v6.2#6252)