From adffaces-user-return-2213-apmail-incubator-adffaces-user-archive=incubator.apache.org@incubator.apache.org Tue Feb 20 22:33:17 2007 Return-Path: Delivered-To: apmail-incubator-adffaces-user-archive@locus.apache.org Received: (qmail 61446 invoked from network); 20 Feb 2007 22:33:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Feb 2007 22:33:16 -0000 Received: (qmail 11303 invoked by uid 500); 20 Feb 2007 22:33:24 -0000 Delivered-To: apmail-incubator-adffaces-user-archive@incubator.apache.org Received: (qmail 11114 invoked by uid 500); 20 Feb 2007 22:33:24 -0000 Mailing-List: contact adffaces-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: adffaces-user@incubator.apache.org Delivered-To: mailing list adffaces-user@incubator.apache.org Received: (qmail 11105 invoked by uid 99); 20 Feb 2007 22:33:24 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Feb 2007 14:33:24 -0800 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of unobriani@gmail.com designates 209.85.132.250 as permitted sender) Received: from [209.85.132.250] (HELO an-out-0708.google.com) (209.85.132.250) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Feb 2007 14:33:13 -0800 Received: by an-out-0708.google.com with SMTP id b2so484191ana for ; Tue, 20 Feb 2007 14:32:52 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=HyBNy3owsjFB4mpFZYfapb6AZxTPpu0JHntsE0aSlqhMb3XjbM+lL9k/uvvcvzpYO/6vR5hpbSu8HharyxceUrUXvvqCtqBwRuLkwFoyleookF6bXR2uN/7U01AOv5IBx3JN5XNPRL5sAQbJ/HWvsa+kkVnIDewDsIgwdWqbyq8= Received: by 10.114.135.1 with SMTP id i1mr3533131wad.1172010771265; Tue, 20 Feb 2007 14:32:51 -0800 (PST) Received: by 10.114.255.19 with HTTP; Tue, 20 Feb 2007 14:32:51 -0800 (PST) Message-ID: Date: Tue, 20 Feb 2007 16:32:51 -0600 From: "Brian Smith" To: adffaces-user@incubator.apache.org Subject: Re: Single user session values retained across other user sessions In-Reply-To: <0EB5586BC84C9D438A52A7CB46EFB43080B227@NAVEXC.corp.int.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_53595_11537399.1172010771204" References: <0EB5586BC84C9D438A52A7CB46EFB43080B227@NAVEXC.corp.int.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_53595_11537399.1172010771204 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Instead of storing your bean in the session, why not use Trinidad's PageFlowScope, You can store the object in it and clear the scope explicitly as needed. On 2/20/07, Causevic, Dzenan wrote: > > > I set up the tree with certain categories on one page. By selecting any of > those categories user is being sent to a another page where that category is > being displayed. > > Now in order to be able to do this, I set up actionListener on the first > page that captures which category user has clicked on, and then stores it in > a bean. The second page (where user is being sent after he made selection) > is simply reading the category from that bean, and displaying it. Everything > works just fine but the problem arises when the user leaves those pages and > then comes back. This should be completely a new session (even if the > browser itself is closed old session values are still there) and the values > from any previous sessions should be reset, but they are not. > > Even if the user closes the browser itself, and opens those pages in a new > browser he will still have those categories automatically pre-selected. That > is the problem. I want every time user leaves those pages, categories > selected during that session to be reset, so that values from previous > sessions dont show up anymore. > > Below are actual code excerpts. I did not include how onet3Tree bean > implements the tree itself since it works fine and it's completely > irrelevant for this specific issue. > > 1. Page with categories implemented as tree (reffered above as a first > page): > > > > > actionListener="#{onet3TreeListener.onet3ItemAction}" action="insert"> > value="#{occupation.onet3Id}"/> > > > > > > > 2. Page where the selected category is then displayed (reffered above as a > second page): > > > > > > > > 3. Tree listener (captures category on which user clicked and stores it in > bean): > import javax.faces.component.UIComponent; > import javax.faces.event.ActionEvent; > > public class Onet3TreeListener { > > /** Creates a new instance of Onet3TreeListener */ > public Onet3TreeListener() { > } > > public void onet3ItemAction(ActionEvent event) > { > UIComponent actionItem = event.getComponent(); > > Onet3Bean treeNode = new Onet3Bean(); > String onet3Id = > (String)actionItem.getAttributes().get("onet3Id"); > treeNode.setOnet3Id(onet3Id); > String onet3Title = > (String)actionItem.getAttributes().get("text"); > treeNode.setOnet3Title(onet3Title); > } > } > > 4. Bean (where the selected category is being stored for the access by the > second page): > public class Onet3Bean { > > /** Creates a new instance of Onet3Bean */ > public Onet3Bean() { > } > > private static String onet3Id; > private static String onet3Title; > private static boolean onet3Selected; > > public void setOnet3Id(String onet3Id) { > this.onet3Id = onet3Id; > } > > public String getOnet3Id() { > return onet3Id; > } > > public void setOnet3Title(String onet3Title) { > this.onet3Title = onet3Title; > } > > public String getOnet3Title() { > return onet3Title; > } > > public boolean isOnet3Selected() { > if(onet3Id != null){ > onet3Selected = (boolean)true; > } else { > onet3Selected= (boolean)false; > } > return onet3Selected; > } > } > > 5. faces-managed-beans.xml: > > onet3TreeListener > com.navisite.view.beans.Onet3TreeListener > > session > > > onet3Bean > com.navisite.view.beans.Onet3Bean > > session > > > This e-mail is the property of NaviSite, Inc. It is intended only > for the person or entity to which it is addressed and may contain > information that is privileged, confidential, or otherwise protected > from disclosure. Distribution or copying of this e-mail, or the > information contained herein, to anyone other than the intended > recipient is prohibited. > ------=_Part_53595_11537399.1172010771204--