incubator-adffaces-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Causevic, Dzenan" <>
Subject Single user session values retained across other user sessions
Date Tue, 20 Feb 2007 16:39:27 GMT

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):
                          <tr:tree var="occupation" value="#{onet3Tree.model}" binding="#{onet3TreeBean.tree}">
                              <f:facet name="nodeStamp">
                                      <tr:commandLink text="#{occupation.onet3Title}" disabled="#{occupation.onet3Category}"
actionListener="#{onet3TreeListener.onet3ItemAction}" action="insert">
                                          <tr:attribute name="onet3Id" value="#{occupation.onet3Id}"/>

2. Page where the selected category is then displayed (reffered above as a second page):
                          <h:outputText escape="false" rendered="#{onet3Bean.onet3Selected}"
styleClass="labelText" value="#{onet3Bean.onet3Title}" />
                          <tr:commandLink rendered="#{onet3Bean.onet3Selected}" text="delete"
actionListener="#{onet3TreeListener.onet3ItemRemove}" action="refresh">
                              <tr:attribute name="onet3Id" value="#{onet3Bean.onet3Id}"

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");
        String onet3Title = (String)actionItem.getAttributes().get("text");

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:   

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.

  • Unnamed multipart/alternative (inline, 7-Bit, 0 bytes)
View raw message