Getting bean from request scope

Hi,
I am new to JSF and unfortunately I am running into a problem that I am not entirely sure about. I look in other forums and what I am doing looks right but I am not getting the desired result.
In my faces-config.xml file I have a managed bean defined as follows:
<managed-bean>
    <managed-bean-name>LogIn</managed-bean-name>
    <managed-bean-class>lex.cac.tables.RefUsers</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
  </managed-bean>I then have a log on page with a form which contains a user name and password field. The tags are defined as
<h:inputText immediate="false" value="#{LogIn.username}" /> (for username) and
<h:inputSecret immediate="false" required="true"
                               value="#{LogIn.password}" /> (for password)
When I submit the form the web app navigates to a jsp page which attempts to do validation against a database.
The first step though is retrieving the object which is suppose to be in request scope.
I attempt the following but I get back null which causes a NullPointerException. Why can't if find the bean?
ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
Map params         = ec.getRequestParameterMap();
params.get("LogIn");  //null is returned hereWhat am i doing wrong? Can someone please help.
Thanks in advance,
Alex.

Something like that:
FacesContext fc = FacesContext.getCurrentInstance();
RefUsers LogIn = (RefUsers)fc.getApplication().createValueBinding("#{LogIn}").getValue(fc);
String username = LogIn.getUsername();
String password = LogIn.getPassword();

Similar Messages

  • Communicating between beans in request scope

    I have list.jsp that has a table of items with a link to edit each item like so
    <h:dataTable value="#{list.model}" var="curItem">
        <h:commandLink actionListener="#{item.doActionEdit}" action="edit">
          <h:outputText value="#{curItem.id}"/>
          <f:param name="id" value="#{curItem.id}"/>
        </h:commandLink>
    </h:dataTable>edit is map to item.jsp
    when i click on the link the item bean gets called and doActionEdit sets up the id and fetches data from db but then the bean gets recreated (from scratch and all data is lots id is unset) and it loads item.jsp with and empty bean.
    This only happens when item bean is in request scope, however when it is in session scope it works fine, which brings the question; how can I pass objects to a bean that is in the request scope?
    I have tries to map id of item in faces-config.xml with #{param.id} which works fine if id is passed but fails with a npe when item.jsp loads without id (say I want to create a new item.)
    Please advise me what is the best approach to communicate between beans in request scope, so it will work with and without id being passed.

    here is doActionEdit, basicly it gets the id param and then calls setId which tries to load data from db if id is >0 if that fails or id is <=0 it creates new data object instead.
    when the item bean is in session scope the constructor is called once but if the scope is request it is called twice (first time doActionEdit is called after constructor but the 2nd time only constructor is called and the itemData is empty.
         public void doActionEdit(final ActionEvent event) {
                    int id = 0;
              try {
                   id = Integer.parseInt(FacesUtil.getParameter("id"));
              } catch (Exception e) {
                   e.printStackTrace();
              setId(id);
    private ItemData data = null;
         public void setId(final int id) {
              if (id > 0) {
                   data = DB.getItemData(id); //load data from db
                   if (data == null) {
                        data=new Data();
              else {          
                   data=new Data();
         public Item() {
              data=new Data();
              System.out.println("Loading Item class");
         }

  • Have a backing bean in request scope; need to access parameters sent to it

    I have a request scope backing bean in my app, 'projectBean'. This has a property called 'id'.
    /** in request scope in faces-config.xml */
    projectBean {
        id               // set by the param from the previous page
        downloadAction() // activated by commandlink, depends on id
    }There is another backing bean in session scope called 'projectListingBean', which has a dataTable that lists a bunch of projectBeans. In this 'projectListingBean', I can click on any row. That row, when clicked initializes a 'id' parameter, which is then passed to the new 'projectBean'. 'projectBean' then initializes itself based on the id.
    In the jsp page backed by 'projectBean', I also have a link to download something specific to that 'projectBean'. Naturally enough, I have a commandlink with actionBinding to a method in my 'projectBean', downloadXXXAction().
    The problem arises because the downloadXXX() method relies on a 'id'. Remember, this id was orinigally set 2 requests back from the datatable. Since the page backed by 'projectBean' is in request scope, the id is lost, and my method call doesn't work. I tried changing the scope of 'projectBean' to session, but JSF complains that I already setting the 'id' property as a param, I can't set the whole managed bean to something 'higher' like session.
    Of course, the ideal fix to this probelm would be the ability to have beans in page scope, but what other ways (hacks??) are there to get around this?

    Hi, I'm posting some code snippets if it helps with understanding the problem.
    faces-config.xml:
    <!-- PROJECTLISTINGBEAN -->
    <managed-bean>
         <managed-bean-name>projectListingBean</managed-bean-name>
         <managed-bean-scope>session</managed-bean-scope>
         <managed-property>
              <property-name>projectBeans</property-name>
              <property-class>java.util.List</property-class>
              <list-entries>
                   <value-class>
                        com.sun.sleuth.omcmweb.view.bean.ProjectBean
                   </value-class>
              </list-entries>
         </managed-property>
    </managed-bean>
    <!-- PROJECTBEAN -->
    <managed-bean>
         <managed-bean-name>projectBean</managed-bean-name>
         <managed-bean-class>
         </managed-bean-class>
         <managed-bean-scope>request</managed-bean-scope>
         <managed-property>
              <property-name>projectId</property-name>
              <property-class>java.lang.String</property-class>
              <value>#{param.projectId}</value>
         </managed-property>
    </managed-bean>projectlsting.jsp (page backed by projectListingBean)
    <h:dataTable value="#{projectListingBean.projectBeans}"
         var="projectBean" ...>
         <h:column>
              <f:facet name="header">
              </f:facet>
              <h:commandLink action="#{projectListingBean.viewProjectSUmmary}">
                   <h:outputText value="#{projectBean.projectId}" />
                   <f:param name="projectId" value="#{projectBean.projectId}" />
              </h:commandLink>
         </h:column>
    </h:dataTable>projectsummary.jsp (page backed by request scoped projectBean)
    <h:commandLink action="#{projectBean.assessmentAction}" value="..." />
    ...Flow:
    projectlisting.jsp (projectListingBean - session) -param id passed->
    projectsummary.jsp (projectBean - request) -commandLink clicked and id lost-->
    projectSummary.jsp (projectBean - request)

  • Initialize managed bean from request parameters

    Hi:
    I thought this topic would be on the FAQ, but I couldn't find it. I am looking for a mean to initialize my managed bean from the query string. There must be something like:
    <h:form initializeBean=""true"" requestParameter=""id_author"" beanProperty=""#{author.id_author}"" action=""#{author.getFromDB}"" >
    </form>
    The url would be something like http://localhost:8080/protoJSF/showAuthor.jsf?id_author=5334
    And the getFromDB method would be something like
      Public void getFromDB()
         Statement stmt = cn.createStatement( ?SELECT * from author where id_author=? + getId_author() );
         ResultSet rs = stmt.executeQuery();
      }The only way I've found to perform something like this is to present a blank author form with a ''load data'' button: after pressing the button the user can see author's data and edit the data if she wants to. This two-step data screening is annoying, to say the least.
    There must be a better way.
    I beg for a pointer on how can I achieve the initializing of a managed bean with dynamic data.
    Regards
    Alberto Gaona

    You just have to read carefully the very fun 289 pages
    specification :-)Or, if 289 pages of JavaServer Faces is too much, you can get almost all of the same information from the JavaServer Pages 2.0 specification, or even the JSP Standard Tag Libraries specification :-).
    More seriously, the standard set of "magic" variable names that JavaServer Faces recognizes is the same as that reognized by the EL implementations in JSP and JSTL. Specifically:
    * applicationScope - Map of servlet context attributes
    * cooke - Map of cookies in this request
    * facesContext - The FacesContext instance for this request
    * header - Map of HTTP headers (max one value per header name)
    * headerValues - Map of HTTP headers (String array of values per header name)
    * initParam - Map of context initialization parameters for this webapp
    * param - Map of request parameters (max one value per parameter name)
    * paramMap - Map of request parameters (String array of values per parameter name)
    * requestScope - Map of request attributes for this request
    * sessionScope - Map of session attributes for this request
    * view - The UIViewRoot component at the base of the component tree for this view
    If you use a simple name other than the ones on this list, JavaServer Faces will search through request attributes, session attributes, and servlet context (application) attributes. If not found, it will then try to use the managed bean facility to create and configure an appropriate bean, and give it back to you.
    For extra fun, you can even create your own VariableResolver that can define additional "magic" variable names known to your application, and delegate to the standard VariableResolver for anything else.
    Craig McClanahan

  • Creation of a Managed Bean in Request Scope?

    Is there an easy way to create an instance of a managed bean (configured in faces-config.xml) that was configured to be in the Request scope?
    If a JSP refers to it by id, then it will be there.
    However, when the JSP does not refer to it, it will not be in the request. I find I need to generate it anyway to use it from within another Managed Bean. I can extract out the faces-config information from the application map (available from FacesContext) and build it manually -- but this ties me to a particular JSF implementation (and probably version, too).
    Is there a more standardized way to do this?
    Thanks,
    ken

    BTW -- I mean to do this from within Java code (not jsp), and the page being rendered does not have a direct reference to the request-scoped managed bean via value binding.

  • Problem in getting attribute from request.

    HI
    I have a JSR 168 portlet which was earlier running in tomcat 6 and liferay...i'm now migrating that in webcenter portal framework 11g.
    after migration when i run it ... i have set some attribute in actionRequest class of processAction method in my portlet and then i 'm getting it in jsp from request(explicit varriable) varriable....
    this was working earlier in liferay/tomcat but somehow it's not working here ... i didn't change any code here... apart from some lspecific ib/class from liferay to oracle.
    please suggest
    thanks

    I think you are mixing some things...
    First of all, if you are creating basic JSP portlets, you don't need to use the ADFPortletBridge. This is only needed when you develop JSF portlets and are using the ADF technology.
    Second of all, you are switching from JSR 168 to 286. The standard has some changes but i don't really know if these changes affect the lifecycle of the portlets in a way that the setAttribute will be broken...
    There are a lot of changes in the parameters so IPC is made easy with JSR 286.
    Maybe you cna elaborte some more about the specific case and we can provide a valid workaround?

  • Help with getting values from request. Very Strange!!

    Hello,
    My very strange problem is the following.
    I have created three dynamic list boxes. When the user select
    the first list box, the second becomes populated with stuff
    from a database. The third becomes populated when the second
    is selected. Now, I have used hidden values in order for
    me to get the selected value from the first listbox. The
    following code is my first listbox:
    <SELECT NAME="resources" onChange="document.hiddenform.hiddenObject.value = this.option [this.selectedIndex].value; document.hiddenform.submit();">
    <OPTION VALUE =""> Resource</OPTION>
    <OPTION VALUE ="soil"> Soil </OPTION>
    <OPTION VALUE ="water"> Water </OPTION>
    <OPTION VALUE ="air"> Air </OPTION>
    <OPTION VALUE ="plants"> Plants </OPTION>
    <OPTION VALUE ="animals"> Animals </OPTION>
    </SELECT>
    I use the getRequest method to get the value of hiddenObject.
    At this time I am able to get the value of hiddenObject to populate
    the second list box.
    But, when the user selects an item from the second list box
    and the second form is also submitted,
    I lose the value of hiddenObject. Why is this??
    The code to populate my second listbox is the following:
    <SELECT NAME ="res_categories" onChange="document.hiddenform2.hiddenObject2.value = this.options[this.selectedIndex].value; document.hiddenform2.submit(); ">
    <OPTION VALUE ="" SELECTED> Category</OPTION>
    Here I access a result set to populate the list box.
    Please help!!

    Form parameters are request-scoped, hence the request.getParameter("hiddenObject"); call after the submission of the second form returns a null value because the hiddenObject parameter does not exist within the second request.
    A solution would be to add a hiddenObject field to your second form and alter the onChange event for res_categories to read
    document.hiddenform2.hiddenObject.value=document.1stvisibleformname.resources.option[document.1stvisibleformname.resources.selectedIndex].value;
    document.hiddenform2.hiddenObject2.value = this.options[this.selectedIndex].value;
    document.hiddenform2.submit();You will then come across a similar problem with your third drop-down if indeed you need to resubmit the form...
    A far better approach would be to create a session scoped bean, and a servlet to handle these requests. Then when the servlet is called, it would set the value of the bean property, thus making it available for this request, and all subsequent requests within the current session. This approach would eliminate the need for the clunky javascript, making your application far more stable.

  • How to get org_id from request?

    Hello all,
    Any ideas on how I can get the org_id from a concurrent_request id?
    To put it a little differently, I have a concurrent_request_id, and would like to know which org it was submitted from?
    Thanks,

    Forgive me as I am trying to be more specific with out being ambiguous, but here goes...
    Example data would be request_id of 12345678.
    And the expected output would be org_id.
    I would like to do something like
    "select org_id from fnd_concurrent_requests where request_id = 12345678"
    But clearly that is not an option. So again I am looking to see what org the request was submitted from?
    Thanks in advance.

  • Get IP from request caller

    We are working on a POC based on user management and Fusion 11.
    We want to include an audit service which stores the following data from the external request:
    1. client application (ex: browser, SOAP UI or any other application)
    2. IP caller
    3. operation / port type requested on exposed service
    Can anyone address us on how to retrieve these data from the external service request?
    Thanks in advance
    Alessandro

    First of all, thanks for your help.
    Second, I've investigated deeper on XPATH and Mediator's Assign values function. I guess this was where you tried to point me.
    Although I still haven't managed to work with the expression you've given me, I was wondering how I can access those properties (service, transport) from the Expression builder GUI.
    The error I get from the Application server is
    SEVERE: Exception while processing deferred message due to ORAMED-02103:[Invalid assign expression]Invalid assign expression "<copy target="$out.LogCollection/top:LogCollection/top:Log/top:whichClient" value="$inbound/ctx:transport/ctx:request/tp:headers/http:User-Agent/text()" xmlns:top="http://xmlns.oracle.com/pcbpel/adapter/db/top/Audit" xmlns="http://xmlns.oracle.com/sca/1.0/mediator"/>
    ".Possible Fix:Check assign xpath expression for any syntax error. If there are any syntax error, correct the xpath expression.
    22-Nov-2009 22:10:19 racle.tip.mediator.common.listener.DBWorker process SEVERE: Enququeing to Error hospital successful...
    Do I have to configure something on the Mediator component, such as an external schema?

  • Avoiding request scope bean clashes for task flow calls

    Hi,
    I have two task flows, Tf1 calls Tf2 using a task flow call activity. The structures of the task flows are as follows:
    Tf1
      Managed Bean: TfBean, request scope
        class Tf1Bean
          has property goTf2Button
      View: View1
        Button bound to #{TfBean.goTf2Button}
          Action -> task flow call to Tf2
    Tf2
      Managed Bean: TfBean, request scope
        class Tf2Bean
          has property testButton
      View: View2
        Button bound to #{TfBean.testButton}
    As you can see both have a request scope bean called TfBean but these are different classes in each. The bean classes have different properties for binding the components on the two pages.
    When I click the button in View1 to navigate I get an error telling me that class Tf1Bean does not have the property testButton. Clearly Tf2Bean is not being instantiated as TfBean already exists for the request.
    I'm guessing this is expected behaviour and it seems logical.
    My question however is what would be good standards or practices to avoid this?
    One way would be a naming convention, however what if I am consuming Tf2 from a library? In this case it would ideally work as a black box and I should not be concerned about it's implementation, specifically names chosen for internal managed beans. Even if it was not a problem initially, the developer of the task flow could add or change the name of a request scope bean introducing a conflict at a later stage.
    Thanks,
    Kevin

    Hi Frank,
    Good to meet you at UKOUG Tech13 yesterday. I changed my test case from request scope to backing bean scope. Unfortunately I still get the same error:
    <RichExceptionHandler> <_logUnhandledException> ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase RENDER_RESPONSE 6
    javax.faces.FacesException: javax.el.PropertyNotFoundException: The class 'yyy.view.Tf1Bean' does not have the property 'testButton'.
      at com.sun.faces.application.ApplicationImpl.createComponentApplyAnnotations(ApplicationImpl.java:1900)
      at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:446)
      at javax.faces.webapp.UIComponentELTag.createComponent(UIComponentELTag.java:222)
      at javax.faces.webapp.UIComponentClassicTagBase.createChild(UIComponentClassicTagBase.java:506)
      at javax.faces.webapp.UIComponentClassicTagBase.findComponent(UIComponentClassicTagBase.java:744)
      at javax.faces.webapp.UIComponentClassicTagBase.doStartTag(UIComponentClassicTagBase.java:1311)
      at org.apache.myfaces.trinidad.webapp.UIXComponentELTag.doStartTag(UIXComponentELTag.java:67)
      at oracle.adfinternal.view.faces.unified.taglib.nav.UnifiedCommandButtonTag.doStartTag(UnifiedCommandButtonTag.java:51)
    ...etc.
    What I think is happening, please correct me if I'm wrong...
    Running Tf1, page View1 is displayed.
    Clicking the button on View1 initiates a request and an instance of Tf1Bean is instantiated for the managed bean named TfBean.
    During the request navigation occurs to Tf2 and hence page View2.
    View2 needs a property in TfBean called testButton.
    There is already a managed bean instantiated for this request called TfBean, however this is of class Tf1Bean and does not have the property.
    I have a simple workspace showing this if you want me to send it to you. I am using 11.1.2.4 by the way.
    Thanks,
    Kevin

  • Problem with Commit button When Backing bean is in Request Scope...

    HI Everybody,
    I have a Backing Bean in request scope having over 1000 lines of code, And in my JSPX page I have a table binding with a view object and At run time when user select the row in table and click the edit button so user will be able to edit that selected row in the same table at run time.. but the problem is : when the user enters some data in the Editable inputTexts and then clicks save(Commit), then the save button doesn't work..but when i delete any selected row and then press save then it is working fine..
    And to test it in Session scope i made another sample page where every thing is working very fine..
    Now i want to know What is the difference between Session scope and request scope bean...
    And is there any solution to Save editable input text in Request scope?.
    Also want to know that is it safe to set the scope of my main bean class to session scope without effecting the current running functionality? which is having over 1000 lines of code and lot of component has been placed...
    Please help me to resolve this problem...
    Thanks in Advance to all of you
    Fizzz..

    Hi Frank...
    In my code i used almost same logic as Andrejus Baranovskis has explained in his Editable Table example...
    You can refer that example to see what problem I'm facing...
    http://andrejusb.blogspot.com/2007/04/create-edit-and-delete-operations-in.html
    The Bean Scope in this Example is Session scope...Save button is working fine...
    But as i Change the bean scope to Request scope then Save button is not working for Edit but it is working for Delete Action very well..
    I want that save button should work also for Edit action in Request Scope..
    Please Make me understand that why it is happened like that..
    and help me to find the solution..
    and Also if you have a better document to Explain the life cycle of Application in Different Bean Scope...So please provide me that Doc to me...
    It would be a great help for me to understand the concept of session...
    Thanks Frank
    Fizzz...

  • How to handle Valuechange events, when page bean is in request scope

    Hello balusc and forum mates,
    I want to know is there any good way to handle ValueChangeEvents events, when the page's bean in request scope.
    My problem is, I have a page having more than 1 value change event so How can I maintain page values at backing bean. My bean is request scope, I can't change to session scope.
    Please I really need it.

    Hi Frank...
    In my code i used almost same logic as Andrejus Baranovskis has explained in his Editable Table example...
    You can refer that example to see what problem I'm facing...
    http://andrejusb.blogspot.com/2007/04/create-edit-and-delete-operations-in.html
    The Bean Scope in this Example is Session scope...Save button is working fine...
    But as i Change the bean scope to Request scope then Save button is not working for Edit but it is working for Delete Action very well..
    I want that save button should work also for Edit action in Request Scope..
    Please Make me understand that why it is happened like that..
    and help me to find the solution..
    and Also if you have a better document to Explain the life cycle of Application in Different Bean Scope...So please provide me that Doc to me...
    It would be a great help for me to understand the concept of session...
    Thanks Frank
    Fizzz...

  • How to remove Bean from session upon leaving the web page?

    Hi...
    I got the following problem
    I promote a user with a Datatable filled with data, each time the user enters the webpage with the table I go the DB and retrieve all relevant data again (so each time the user gets an OnLine representation of the DB)
    to archive that I defined the bean that pulls data from DB in Request scope. and it worked well... but now i added an option to export the table into Pdf made by a servlet.... now to be able to get the bean from the servlet i had to change the scope of the Bean to Session Scope... and all works fine.. BUT... now the page not showing OnLine representation of the DB.. cause its only created once , cause its inside Session Scope...
    My question is how can I remove the Bean from Session scope upon the user leaving the page (I don't want to remove the bean from session scope on the next called bean of the other page) i want to remove the Bean upon leaving the current web page... Or maybe force the constructor to be executed each time the Page is loaded (as if it was a Request scope bean)....
    Any ideas?
    Thanks ahead!
    Daniel.

    Hi,
    When you are moving to another page, you are performing an action right ?
    (i mean the request moving to Server side), if you do so, then clear the bean object values list.
    for example :
        private List<Integer> intList = new ArrayList<Integer>();
      public void clear()
       intList.clear();
    or
    store a new object in session, when ever u moved to the second page, so that the old object will be no longer
    in use, so it will be garbage collected.Regards,
    Sathya.

  • Clearing variable from Request object

    Hi everyone,
    After getting value from request.getParameter("var"), I want to clear this "var" variable from request scope. So that in the next coming statements if i again call the same request.getParameter("var") statement than it must return null
    So how to handle this issue of clearing certain variable from request scope or flushing the whole request object

    I don't know what you are trying to do but it sounds confused. I would suggest you read the parameter once, at the beginning of the code. Store it in a variable and use that variable as necessary. If you still need help then would you explain what you are trying to achieve here.

  • Problem with beans in session scope

    Hello,
    I developped a website using JSP/Tomcat and I can't figure out how to fix this problem.
    I am using beans in session scope to know when a user is actualy logged in or not and to make some basic informations about him avaible to the pages. I then add those beans to an application scope bean that manages the users, letting me know how many are logged in, etc... I store the user beans in a Vector list.
    The problem is that the session beans never seem to be destroyed. I made a logout page which use <jsp:remove/> but all it does is to remove the bean from the scope and not actualy destroying it. I have to notify the application bean that the session is terminated so I manualy remove it from its vector list.
    But when a user just leave the site without using the logout option, it becomes a problem. Is there a way to actualy tell when a session bean is being destroyed ? I tried to check with my application bean if there are null beans in the list but it never happens, the user bean always stays in memory.
    Is there actualy a way for me to notify the application bean when the user quits the website without using the logout link ? Or is the whole design flawed ?
    Thanks in advance.
    Nicolas Jaccard

    I understand I could create a listener even with my current setup Correct, you configure listeners in web.xml and they are applicable to a whole web application irrespective of whether you use jsp or servlets or both. SessionListeners would fire when a session was created or when a session is about to be dropped.
    but I do not know how I could get a reference of the application bean in >question. Any hint ?From your earlier post, I understand that you add a UserBean to a session and then the UserBean to a vector stoed in application scope.
    Something like below,
    UserBean user = new UserBean();
    //set  bean in session scope.
    session.setAttribute("user", user);
    //add bean to a Vector stored in application scope.
    Vector v = (Vector)(getServletContext().getAttribute("userList"));
    v.add(user);If you have done it in the above fashion, you realize, dont you, that its the same object that's added to both the session and to the vector stored in application scope.
    So in your sessionDestroyed() method of your HttpSessionListener implementation,
    void sessionDestroyed(HttpSessionEvent event){
         //get a handle to the session
         HttpSession session = event.getSession();
          //get a handle to the user object
          UserBean user = (UserBean)session.getAttribute("user");
           //get a handle to the application object
          ServletContext ctx = session.getServletContext();
           //get a handle to the Vector storing the user objs in application scope
            Vector v = (Vector)ctx.getAttribute("userList");
           //now remove the object from the Vector passing in the reference to the object retrieved from the Session.
            v.removeElement(user);
    }That's it.
    Another approach would be to remove the User based on a unique identifier. Let's assume each User has a unique id (If your User has no such feature, you could still add one and set the user id to the session id that the user is associated with)
    void sessionDestroyed(HttpSessionEvent event){
         //get a handle to the session
         HttpSession session = event.getSession();
          //get a handle to the user object
          UserBean user = (UserBean)session.getAttribute("user");
           //get the unique id of the user object
           String id = user.getId();
           //get a handle to the application object
          ServletContext ctx = session.getServletContext();
           //get a handle to the Vector storing the user objs in application scope
            Vector v = (Vector)ctx.getAttribute("userList");
           //now iterate all user objects in the Vector
           for(Iterator itr = v.iterator(); itr.hasNext()) {
                   User user = (User)itr.next();               
                    if(user.getId().equals(id)) {
                           //if user's id is same as id of user retrieved from session
                           //remove the object
                           itr.remove();
    }Hope that helps,
    ram.

Maybe you are looking for

  • A listener on a dialog

    JOptionPane jop=new JOptionPane(jp,JOptionPane.QUESTION_MESSAGE,JOptionPane.YES_NO_OPTION,null,options,options[0]); JDialog jd=new JDialog(jf,nameOfTeam.getText()); jp is a JPanel, options is an array of the button text strings and jf is the frame th

  • No Data Shown because an error occurred while running the query

    Discoverer 10gR2 using Plus on Firefox: I have one workbook. The first sheet summarizes by Vendor. Parameters are Type, Category, Vendor (all optional) and mandatory date range. The second sheet summarized by Vendor and Model. Parameters are Type, Ca

  • Crash while trying to export on Leopard (New bug)

    Note that this bug seems to be slightly different then the bug referenced in the post "Aperture 1.5.6 Crashing with Leopard". In my case, just selecting "Export > Export Version" from either the "File" menu or the contextual menu causes Aperture to c

  • Ask for help on UTL_FILE

    How can I tell the value of the UTL_FILE_DIR parameter? I met error like the follow. SQL*Plus screen dump. SQL> DECLARE 2 fl UTL_FILE.FILE_TYPE; 3 in_buffer VARCHAR2(20):= 'Test'; 4 BEGIN 5 fl:=UTL_FILE.FOPEN ('/tmp', 'test.txt', 'w'); 6 dbms_output.

  • Following Paragraph Style - a bug?

    I have a list style that is currently active. I am on that list style now and over in the More section of the Text pane in the inspector, I choose a paragraph style as the "Following Paragraph Style". However when I hit return (to start a new paragra