TreeSelectionListener  valueChanged() called twice on selecting TreeNode

Hi All,
This is a class which extends JTree class forms a Tree displaying employee information.Listener is written which should find the list of selected Employee nodes of tree component.
The method valueChanged() of treeListener is getting called twice for every node selected. Please find the code.
Is there any alternative to find the list of selected nodes when they are selected using mouse or shift key.
Even I am facing this in case of row selection of JTable.The listener method is called twice. Could you please let me know your views and any tutorials or examples codes for handling such cases.
public class TestingTreeModel extends JTree {
     //public vector myMOType;
     public TestingTreeModel() {
          super();
     public void setData(ArrayList testVOs) {
          // set the option of selecting multiple nodes
          this.getSelectionModel().setSelectionMode(
               TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
          this.setRootVisible(false);
          setModel(rootTreeNode, testVOs);
          // DefaultTreeModel is used.
          this.setModel(new DefaultTreeModel(rootTreeNode));
          // Listener for selected nodes..
          MyTreeSelectionListener myTreeListener = new MyTreeSelectionListener();
          this.addTreeSelectionListener(myTreeListener);
// which sets the data.
     public void setModel(DefaultMutableTreeNode rootNode, ArrayList empVOs) {
          if empVOs!= null && empVOs.size() > 0) {
               Iterator empItr = empVOs.iterator();
               while (neItr.hasNext()) {
                    Employee empVO = (Employee) empItr.next();
                    DefaultMutableTreeNode node =
                         new DefaultMutableTreeNode(empVO.getName());
                    rootNode.add(node);
// Listener
     public class MyTreeSelectionListener implements TreeSelectionListener {
          public void valueChanged(TreeSelectionEvent evt) {
               // Get all nodes whose selection status has changed     
               System.err.println("Listener is called here check how many times");
               getSelectedNodes(evt);
     private void getSelectedNodes(TreeSelectionEvent evt) {
          System.err.println("came inside getSelectedNodes");
          TreePath[] paths = evt.getPaths();
          // Iterate through all affected nodes
          System.err.println(" Length is " + paths.length);
          for (int i = 0; i < paths.length; i++) {
               TreePath tp = paths;
               Object[] o = tp.getPath();
               for (int j = 0; j < o.length; j++) {
                    System.out.println(
                         "Class: " + o[j].getClass() + "; value: " + o[j]);
                    if (o[j] instanceof DefaultMutableTreeNode) {
                         Object uo = ((DefaultMutableTreeNode) o[j]).getUserObject();
                         if (uo != null) {
                              System.out.println(
                                   "\tUser object class: "
                                        + uo.getClass()
                                        + "; value: "
                                        + uo);
     private ArrayList empIDList = new ArrayList();
     private DefaultMutableTreeNode rootTreeNode = null;
Thanks in advance.

Hi Arun,
JDev version is Studio Edition Version 11.1.1.5.0.
Yes, i do have value change listener on the CompanyName LOV. What is a parameter form? The LOV is defined on the page in the following way:
                            <af:selectOneChoice value="#{bindings.CompanyName.inputValue}"
                                                required="#{bindings.CompanyName.hints.mandatory}"
                                                shortDesc="#{bindings.CompanyName.hints.tooltip}"
                                                id="soc1" autoSubmit="true"
                                                unselectedLabel="--select--"
                                                contentStyle="width:17em;"
                                                binding="#{backingBeanScope.backing_Company.soc1}"
                                                valueChangeListener="#{backingBeanScope.backing_Company.companyChangeListener}">
                              <f:selectItems value="#{bindings.CompanyName.items}"
                                             binding="#{backingBeanScope.backing_Company.si1}"
                                             id="si1"/>
                            </af:selectOneChoice>

Similar Messages

  • JList valueChanged -- called twice

    I found an explanation (and that this is not a problem of my code).
    It's about MouseDown and MouseUp, isn't it?
    Which is the easier way to avoid this?
    I want when i click to do my selection, to have an action only once.
    Thanx in advance.

    No, it isn't about mouse up and down. You have a ListSelectionEvent given as your parameter, right? Look at its getValueIsAdjusting() method, and do your processing only when that returns false.

  • Why listener methods are getting called twice ?

    Hi Group,
    I have a doubt, i need to know logic behind it.
    Lets consider, JComboBox,
    For an item state change of JComboBox,
    itemStateChanged method gets called twice.
    Its similar with valueChanged getting called twice
    on List Selection Event.
    Why does it call twice ? Is there any way, I can
    have invocation only once (except flagging mechanism)?
    with regards,
    vikram.

    http://java.sun.com/j2se/1.3/docs/api/java/awt/event/ItemListener.html
    tells the following:
    public void itemStateChanged(ItemEvent e)
    Invoked when an item has been selected or deselected. The code written for this method performs the operations that need to occur when an item is selected (or deselected).
    So the listener is notified for both items: losing and gaining selection.
    If you are only interested in listening to either selection or deselection event you can check which was the cause for the method call by examing the ItemEvent parameter i.e. item_event.getStateChange() == ItemEvent.DESELECTED or ItemEvent.SELECTED and then decide whether you are interested in the event at all.
    I don't know how to stop JComboBox from launching both select and deselected events.

  • Why valueChaged( ) method called twice

    Dear All,
    I have made a class MyList by extending JList and implements ListSelectionListener and override valueChanged method. When we clicked on the list item this method called twice. Can you please explain the region?
    I write my code like that:
    Public void valueChanged(ListSelectionEvent lse)
    System.out.println(�Hello�);
    Out put:
    Hello
    Hello
    Thanks
    Bipin Kuma

    It's expected - check the details and you'll see why.
    If, say, the user had selected item 3 and then select item 8 then you might get two events:
    1. first 3, last 3, isAdjusting true
    2. first 8, last 8, isAdjusting false
    It's a poor event protocol if you ask me but there you go.

  • WDDOMODIFY is getting called twice.

    Hi,
    I am facing a problem where wddomodify is getting called twice when I am selecting a value from a drop down. While for other drop downs on the same view WDDOMODIFY is not even getting called. I would appreciate, if anyone of you can provide any info regarding the same.
    Thanks,
    Vishesh

    DATA LO_ND_IMPORTING_CREATE TYPE REF TO IF_WD_CONTEXT_NODE.
        DATA LO_EL_IMPORTING_CREATE TYPE REF TO IF_WD_CONTEXT_ELEMENT.
        DATA LS_IMPORTING_CREATE TYPE WD_THIS->ELEMENT_IMPORTING_CREATE.
        DATA LV_DOC_TYPE TYPE WD_THIS->ELEMENT_IMPORTING_CREATE-DOC_TYPE.
      navigate from <CONTEXT> to <IMPORTING_CREATE> via lead selection
        LO_ND_IMPORTING_CREATE = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_IMPORTING_CREATE ).
      get element via lead selection
        LO_EL_IMPORTING_CREATE = LO_ND_IMPORTING_CREATE->GET_ELEMENT( ).
      get single attribute
        LO_EL_IMPORTING_CREATE->GET_ATTRIBUTE(
          EXPORTING
            NAME =  `DOC_TYPE`
          IMPORTING
            VALUE = LV_DOC_TYPE ).
         DATA LO_ND_IF_EDITABILITY TYPE REF TO IF_WD_CONTEXT_NODE.
         DATA LO_EL_IF_EDITABILITY TYPE REF TO IF_WD_CONTEXT_ELEMENT.
         DATA LV_EDIT_SUB_TYPE     TYPE WD_THIS->ELEMENT_IF_EDITABILITY-EDIT_SUB_TYPE.
         DATA LV_EDIT_PARENT       TYPE WD_THIS->ELEMENT_IF_EDITABILITY-EDIT_PARENT.
         DATA LV_DROPDOWN          TYPE REF TO CL_WD_DROPDOWN_BY_KEY.
         DATA LV_INPUTFIELD        TYPE REF TO CL_WD_INPUT_FIELD .
       navigate from <CONTEXT> to <IF_EDITABILITY> via lead selection
         LO_ND_IF_EDITABILITY = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_IF_EDITABILITY ).
       get element via lead selection
         LO_EL_IF_EDITABILITY = LO_ND_IF_EDITABILITY->GET_ELEMENT( ).
         LO_EL_IF_EDITABILITY->GET_ATTRIBUTE(  EXPORTING   NAME =  `EDIT_SUB_TYPE`
                                               IMPORTING  VALUE = LV_EDIT_SUB_TYPE ).
         LO_EL_IF_EDITABILITY->GET_ATTRIBUTE(  EXPORTING   NAME =  `EDIT_PARENT`
                                               IMPORTING  VALUE = LV_EDIT_PARENT ).
          DATA LO_ND_FUNCTIONALITY TYPE REF TO IF_WD_CONTEXT_NODE.
          DATA LO_EL_FUNCTIONALITY TYPE REF TO IF_WD_CONTEXT_ELEMENT.
          DATA LS_FUNCTIONALITY TYPE WD_THIS->ELEMENT_FUNCTIONALITY.
          DATA LV_OPTION_CHANGED TYPE WD_THIS->ELEMENT_FUNCTIONALITY-OPTION_CHANGED.
          DATA LV_OPTION_SELECTED TYPE WD_THIS->ELEMENT_FUNCTIONALITY-OPTION_SELECTED.
        navigate from <CONTEXT> to <FUNCTIONALITY> via lead selection
          LO_ND_FUNCTIONALITY = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_FUNCTIONALITY ).
        get element via lead selection
          LO_EL_FUNCTIONALITY = LO_ND_FUNCTIONALITY->GET_ELEMENT( ).
        get single attribute
          LO_EL_FUNCTIONALITY->GET_ATTRIBUTE(
            EXPORTING
              NAME =  `OPTION_CHANGED`
            IMPORTING
              VALUE = LV_OPTION_CHANGED ).
          LO_EL_FUNCTIONALITY->GET_ATTRIBUTE(
            EXPORTING
              NAME =  `OPTION_SELECTED`
            IMPORTING
              VALUE = LV_OPTION_SELECTED ).
      DATA LO_EL_CONTEXT TYPE REF TO IF_WD_CONTEXT_ELEMENT.
      DATA LS_CONTEXT TYPE WD_THIS->ELEMENT_CONTEXT.
      DATA LV_SET_STATE TYPE WD_THIS->ELEMENT_CONTEXT-SET_STATE.
    get element via lead selection
      LO_EL_CONTEXT = WD_CONTEXT->GET_ELEMENT( ).
    get single attribute
      LO_EL_CONTEXT->GET_ATTRIBUTE(
        EXPORTING
          NAME =  `SET_STATE`
        IMPORTING
          VALUE = LV_SET_STATE ).
      IF LV_SET_STATE = 'X'.
      IF LV_DOC_TYPE = 'ABC' AND LV_EDIT_SUB_TYPE IS INITIAL.
         LO_EL_IF_EDITABILITY->SET_ATTRIBUTE(
              NAME =  `EDIT_SUB_TYPE`
              VALUE = 'X' ).
          LV_DROPDOWN ?= VIEW->GET_ELEMENT('DRPDWN_SUBTYPE_CHANGE').
          CALL METHOD LV_DROPDOWN->SET_STATE
            EXPORTING
              VALUE  = 01
          ELSE.
          LO_EL_IF_EDITABILITY->SET_ATTRIBUTE(
              NAME =  `EDIT_SUB_TYPE`
              VALUE = '' ).
          LV_DROPDOWN ?= VIEW->GET_ELEMENT('DRPDWN_SUBTYPE_CHANGE').
          CALL METHOD LV_DROPDOWN->SET_STATE
            EXPORTING
              VALUE  = 00
        ENDIF.
        IF LV_EDIT_PARENT IS INITIAL AND
                    ( LV_DOC_TYPE = '123' OR LV_DOC_TYPE = 'qwerty').
          LO_EL_IF_EDITABILITY->SET_ATTRIBUTE(
              NAME =  `EDIT_PARENT`
              VALUE = 'X' ).
          LV_DROPDOWN ?= VIEW->GET_ELEMENT('DRPDWN_PARENT_CHNG_DOCTYPE').
          CALL METHOD LV_DROPDOWN->SET_STATE
            EXPORTING
              VALUE  = 01
          LV_INPUTFIELD ?= VIEW->GET_ELEMENT('IF_PARENT_CHNG_DOCNUM').
          CALL METHOD LV_INPUTFIELD->SET_STATE
            EXPORTING
              VALUE  = 01
          ELSE.
          LO_EL_IF_EDITABILITY->SET_ATTRIBUTE(
              NAME =  `EDIT_PARENT`
              VALUE = '' ).
          LV_DROPDOWN ?= VIEW->GET_ELEMENT('DRPDWN_PARENT_CHNG_DOCTYPE').
          CALL METHOD LV_DROPDOWN->SET_STATE
            EXPORTING
              VALUE  = 00
          LV_INPUTFIELD ?= VIEW->GET_ELEMENT('IF_PARENT_CHNG_DOCNUM').
          CALL METHOD LV_INPUTFIELD->SET_STATE
            EXPORTING
              VALUE  = 00
        ENDIF.
         LO_EL_CONTEXT->SET_ATTRIBUTE(     NAME =  `SET_STATE`
                                          VALUE =   ' ' ).
      ENDIF.
      LO_EL_CONTEXT->GET_ATTRIBUTE(
        EXPORTING
          NAME =  `SET_STATE`
        IMPORTING
          VALUE = LV_SET_STATE ).
          IF LV_OPTION_CHANGED = 'X' AND LV_OPTION_SELECTED = 'C'.
              DATA LO_ND_ZGGL TYPE REF TO IF_WD_CONTEXT_NODE.
              DATA LO_EL_ZGGL TYPE REF TO IF_WD_CONTEXT_ELEMENT.
            navigate from <CONTEXT> to <ZGGL_RICEFTOOL> via lead selection
              LO_ND_ZGGL = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_ZGGL).
              LO_ND_ZGGL->INVALIDATE( ).
            get element via lead selection
              LO_EL_ZGGL = LO_ND_ZGGL->GET_ELEMENT( ).
              LO_ND_IMPORTING_CREATE->INVALIDATE( ).
              LO_EL_IMPORTING_CREATE = LO_ND_IMPORTING_CREATE->GET_ELEMENT( ).
              LO_EL_IMPORTING_CREATE->SET_ATTRIBUTE(      NAME =  `VISIBILITY_GROUP`
                                                         VALUE =   '2' ).
              LO_EL_IMPORTING_CREATE->SET_ATTRIBUTE(      NAME =  `VISIBILITY_TABLE`
                                                         VALUE =   '1' ).
              LO_EL_IMPORTING_CREATE->SET_ATTRIBUTE(
                   NAME =  `ACTION_RDBTN`
                   VALUE = 'C' ).
              LO_EL_IF_EDITABILITY->SET_ATTRIBUTE(
                  NAME =  `EDIT_CREATE`
                  VALUE = ' ' ).
             LO_EL_IF_EDITABILITY->SET_ATTRIBUTE(
                  NAME =  `EDIT_DISPLAY`
                  VALUE = 'X' ).
             LO_EL_FUNCTIONALITY->SET_ATTRIBUTE(    NAME  =  `OPTION_CHANGED`
                                                     VALUE = ' ' ).
            ENDIF.

  • PrepareForDML method called twice

    Have implemented a typical scenario (search - add - edit jspx pages).
    Within one application module, one view object with dynamically created where criterion is used for searching, and another view object fetching at most one row is used for inserting/updating. The second view object is based on a join of an updatable entity (that has as primary key trigger-generated sequence number) and several referenced readable entities that bring descriptions of the codes of the updatable entity. Have implemented descriptions as output fields in the jspx, settign partialTriggers to the id of the code-field of the updatable entity having autoSubmit=true. Have concentrated business validation logic within the prepareForDML() of the updatable entity implementation.
    Under normal conditions, it works fine.
    Under heavy system load in production, or testing with ADF State Management enabled at work environment, I observe the prepareForDML() called twice instead of once.
    Thus, the first time the insert is commited, the second time the validation rollback, and at last the whole transaction is rollbacked.
    When I commented-out all the fields that bring descriptions and set all autoSubmit=false, prepareForDML() was called once.
    However, my problem is that I have to bring the descriptions, that result from pop-up windows so that the end-user can see them after selecting sthg on his/er screen.
    Why is prepareForDML() called twice, and how can I avoid this?

    (2) Can't change the second trigger-assigned field from DBSequence to simply Number since the Entity Object Editor hides the tab Sequence to declare the sequence from which to get this field's value after insert.
    Please see section "6.6.3.8 Trigger-Assigned Primary Key Values from a Database Sequence" of the ADF Developer's Guide for Forms/4GL Developers on the ADF Learning Center at http://www.oracle.com/technology/products/adf/learnadf.html for more information on this. The "Sequence" tab doesn't have any runtime behavior influence. The sequence number is not assigned by ADFBC, it is assigned by your trigger. ADFBC only worries about:
    1) Providing a temporary unique negative key so that new detail rows can have a temporary foreign key value to point at until the transaction commits
    2) Refreshing the entity object's primary key value from the database-trigger assigned sequence number (however, we really don't know how the trigger populated the value) Theoretically, it may or may not have used a database sequence to assign the number. It would work just the same at the ADFBC level)
    3) Refreshing the temporary negative foreign key values in newly-created detail rows for new, composed details of the new composing master row with the definitive primary key value.
    So, you should safely be able to change this to a Number, with its Refresh after Insert property set.
    (3) Create() on entity implementation was always called once at page load, unexpectedly prepareForDML() always carried on two consequtive rows (either the new row to insert twice or the query's first row retrieved to update and afterwards the new row to insert) having State Management enabled.
    If create() is being called only once, then next you should check the value of the "operation" flag that is passed to prepareForDML() to understand if the method is being called for DML_INSERT or DML_UPDATE. Perhaps somehow an existing row is being inadvertently updated so one of the calls to prepareForDML() might be an update? I don't understand how prepareForDML() could fire twice for two new entity objects if the entity object's create() method is only called once. If you have a testcase that illustrates this, please report it to Worldwide Support via Metalink so they can triage and file a bug for you on it.
    (4) Swapping selectInputText components with SelectOneChoice, thus avoiding the partial page rendering, I managed prepareForDML() to function logically so that to have only one row to insert, but again since I have validation code in my entity implementation that throws JBO-exceptions, another problem occured. The first time the end-user receives an exception (e.g. invalid Tax Number), the second time he/she corrects it, the created row instance at prepareForDML() doesn't get updated with the new valid Tax Number, but continues to hold the old value at second run. To remind that if insert is successful the navigation moves on to the update page, otherwise it remains at the same (navigation outcome is null).
    Are you absolutely sure in this case that a second new row is not getting created?

  • Page flow actions are called twice from each UI's action=...

    Odd observation: my nothing fancy login / pw change / logged in / jsps and pageflow are having the actions in the .jpf called twice for each jsp form action=.
    What can cause this?
    For example: the login jsp form action=loginAction, the corresponding method in the .jpf is called twice when the user clicks the login button on the login UI. The same behavior is observed for all the other actions in this page flow too.
    This has been a real problem for the pw change UI. Until I figured this out, pw change always returned invalid pw due to the second call to the action. :))
    tnx curt

    I have narrowed it down even more. What is happening is that you select the first item in the list it throws a validation error. I found this by adding and inline message. The weird thing is that if you select any other item in the list but the first everything flows as normal.
    This is a list of dates bound to a date type column in a database.
    Any Idea's why selecting the first item in a list would throw the validation message?

  • JList's ListSelectionListener got called twice

    Hi all,
    I have a JList which once i click a item in the list, this valueChanged method got called twice. I want it to be called once..
    public void valueChanged(ListSelectionEvent e){
    What do i do to make this method get fired up only once when i click a element from the list?
    thanks. need to complete project soon... all comments are appreciated!

    the code below only fire once, use getvalueisadjusting()
    jList1.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
                public void valueChanged(ListSelectionEvent e) {
                    if(e.getValueIsAdjusting()){
                        System.out.println("test");    
            });

  • Servlet doPost being called twice

    Hello all,
    I have a servlet that is being called twice. The servlet is used to direct the user to the next jsp. I have 4 JSPs that the user steps through to add a record to a database. The 1st JSP lists the records that they have and asks them to add, edit or delete. The servlet gets call to direct them to the next JSP that they enter the data (or update) on. It then calls a verification JSP so the user can verify the information before submitting it. If everything is fine they submit the data. This verification JSP calls the servlet that adds or updates the record in the database. The servlet then directs the user to a confirmation page that tells the user if the submit was successful or not.
    Here is how the flow is:
    servlet -->menu.jsp -->servlet -->add.jsp -->verification.jsp -->servlet -->confirmation.jsp
    Everything is fine until the verification.jsp submits to the servlet. That's where the doPost gets called twice.
    I have put System.outs in the servlet code to see how many times the doPost gets called. It gets called once for every JSP except the verification JSP. When the user submits the data, the servlet's doPost gets called twice therefore it tries to add the record twice.
    Has anyone had this problem before? How do I fix it?
    Any help would be greatly appreciated!!
    Tracey

    Here is the output of the JSP that when submitted, calls the doPost twice:
    <HTML>
    <HEAD>
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <TITLE>PreaPaid Legal Banner Verification</TITLE>
    <script language="javascript">
    function new_window(url){
    link = window.open(url,"Link","toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,width=650,height=450,left=50,top=50");
    </script>
    </HEAD>
    <BODY>
    <form name="myForm" action="/webapp/BannerTracker/BannerTrackingServlet" method="post">
    <H3><font face="Arial">Banner Tracking Verification</font></H3>
    <table BORDER=0 CELLSPACING=0 CELLPADDING=0 COLS=2 WIDTH=500><tr><td>
    <font face="Arial" size=2>Below are the choices that you made for your image, size of the image and page to direct people to
    when they click on your banner.
    <br><br>If this is not what you would like, click the "Back" button to return to the Banner Selection page.
    <br><br>You can click on the page link to view a sample of the age you have choosen.
    </font></td></tr></table>
    <P>
    <font face="Arial" size=2>
    <input type="hidden" name="cmd" value="doadd">
    <input type="hidden" name="banname" value="yahoo">
    <input type="hidden" name="banlogin" value="test">
    <input type="hidden" name="banid" value="1">
    <input type="hidden" name="bangname" value="difference">
    <input type="hidden" name="bangsize" value="468x60">
    <input type="hidden" name="banpage" value="go/test?:home">
    <input type="hidden" name="session" value="PPL2P6LcONLiT45pSszZEb1GJ4HvRc5jQMDNPM8wCJ0rCZesD38oEZ4mC3KvCp8mDp00">
    <input type="hidden" name="bangtype" value="gif">
    <input type="hidden" name="banurl" value="<A HREF="http://www.prepaidlegal.com/go/test?banid=1&Assoc=test"><img src="http://www.prepaidlegal.com/html/buttonsdifference468x60.gif" border=0></A>">
    <br><b>Banner name: </b>yahoo
    <br><br><b>Page to be directed: </b>Your PPL Home Page
    <br><br><b>Image selected: </b><img src=/html/buttons/difference468x60.gif >
    <br><br><b>Copy the URL below to the banner source code.</b>
    <br><br><img src="http://www.prepaidlegal.com/html/buttonsdifference468x60.gif " border=0>
    </font>
    <br><br>
    <a><img src="/html/buttons/track_back.gif" border=0 onClick="window.history.back();"></a>
    <input type=image src="/html/buttons/track_continue.gif" border=0 onClick="javascript:document.myForm.submit();">
    </form>
    </BODY>
    </HTML>
    Here is the doPost code from my servlet:
    public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
    System.out.println("doPost called");
    String next = "";
    try
    Command cmd = lookupCommand(req.getParameter("cmd"));
    next = cmd.execute(req);
    } catch (CommandException ce) {
    req.setAttribute("javax.servlet.jsp.jspException", ce);
    next = error;
    } catch (SQLException se) {
    req.setAttribute("javax.servlet.jsp.jspException", se);
    next = error;
    HttpSession mysession = req.getSession(true);
    String session = String.valueOf(mysession.getAttribute("storedSession"));
    if (session.equalsIgnoreCase("null"))
    session = req.getParameter("session");
    try
    checkSession(session);
    } catch (IOException ioe) {
    System.err.println("Session exception: " + ioe.getMessage() + ".");
    next = expire;
    } else {
    try
    checkSession(session);
    } catch (IOException ioe) {
    System.err.println("Session exception: " + ioe.getMessage() + ".");
    next = expire;
    if ( session != null )
    mysession.setAttribute("storedSession", session);
    RequestDispatcher rd;
    rd = getServletContext().getRequestDispatcher(jspdir + next);
    rd.forward(req, res);
    </code>
    I hope this helps.
    Tracey

  • ItemListener calls Twice

    Hi,
    I am having a ComboBox and when I select an Item, my listener calls twice.
        cmbInputSource.addItemListener(new java.awt.event.ItemListener() {
          public void itemStateChanged(ItemEvent e) {
              setInputSource(cmbInputSource.getSelectedItem().toString());
        });Thats my code, I am using this code in my Constructor, but I still dont find why this method calls twice.
    Any Ideas?
    Thnx

    Great job ��we define this not a bug, but a feature :/
    Or is anyone serious that it is good API design to make a method name look self-explanatory, but have an important detail hidden in the documentation?
    The unnecccessary double call of event listeners may potentially decrease the perceived performance of the system by 50% ��this shouldn't be a favourite solution.
    I searched the bug database for an "RFE" concerning this point, didn't find one. However I don't file one, as I don't have a simple test code at hand to demonstrate the problem.
    Martin

  • ADF selectonechoice valuebinding called twice

    Does anyone have any idea why the valuebinding method of an ADF SelectOneChoice component would be called twice? I have one drop down with values and when I select something in that drop down the valuebinding for the second drop down is called twice, when it should only be called once. Any help would be appreciated.

    Hi,
    what is the refresh setting of the region binding in the page's PageDef file? Put a print statement to the task flow initializer to verify the region is executed twice
    Frank

  • JComboBox  itemStateChanged gets called twice.

    Hi i have a JComboBox whoes itemStateChanged gets called twice. I have taken a look at other post concerning this topic and non have worked for me . I will greatly appreciate it if someone can help me
    here is the code !!!!!!!!!!
    jComboBox3.addItemListener(new ItemListener(){
    public void itemStateChanged(ItemEvent e) {
    if(e.getStateChange() == e.SELECTED){
    jComboBox3_dosomething(e);
    thanks in advance

    Maybe this thread will answer why it gets called twice:
    http://forum.java.sun.com/thread.jsp?forum=57&thread=257226

  • Is this a Bug?: FocusListener called twice

    Hey all,
    Im having this problem since realease 1.4.2_04.
    Folks, try this code:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class FocusTest {
        public static void main(String[] args) {
            JFrame frame  = new JFrame("Focus test");
            final JTextField field1 = new JTextField("Test1");
            final JTextField field2 = new JTextField("Test2");
            field1.addFocusListener(new FocusAdapter(){
                public void focusGained(FocusEvent e){}
                public void focusLost(FocusEvent e){
                    if( !e.isTemporary() ){
                        System.out.println("ID: " + e.getID());
                        JOptionPane.showMessageDialog(null, "Focus lost in 1");
                        field1.requestFocus();
            frame.getContentPane().add(field1, BorderLayout.WEST);
            frame.getContentPane().add(field2, BorderLayout.CENTER);
            frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
            frame.setBounds(0,0,200,300);
            frame.show();
    } The problem is: when TF1 looses its focus, and is validated, then i force the focus to keep on TF1 by calling TF1.requestFocus(), somehow the event focusLsot is called twice for my TF.
    If i do not requestFocus() it work but I must force the focus on TF1.
    Im going nuts. Does anyonw apear to have this problems?? In old realeses, the same code work perfect. until 1.4.2 beta.
    Tks
    Bruno

    Hello all!
    I found out that somehow JDialog with requestfocus after, fires twice the lostFocus event. I dont know why. I opened a bug report so they can figure it out why is happaning.
    Tks folks!
    Bruno

  • HELP!!! why derived class's function  be called twice?

    I am a newbie to java.
    Recently I encounter a problem.
    I run the below file,the output is:
    output begin
    B.f called !!!!
    A.A called
    B.f called !!!!
    B.B called
    output end-
    My Question is :
    why B's f() be called twice?
    (In C++, A.f() will be called one time!)
    class A
    A()
    f();
    System.out.println("A.A called");
    int f()
    System.out.println("A.f called !!!");
    return 123;
    class B extends A
    B()
    f();          
    System.out.println("B.B called");
    int f()
    System.out.println("B.f called !!!!");
    return 456;
    public class Demo
    public static void main(String args[])
    B bobj = new B();
    -----------------------------------

    Hi,jsalonen:
    In the following code, variable i cann't be initialized properly.
        class A
             int i=0;
            A()
                f();
                System.out.println("A.A called");
                System.out.println("i="+i);
            int f()
                i=11;
                System.out.println("A.f called !!!");
                return 123;
        class B extends A
             int j;
            B()
                f();                  
                System.out.println("B.B called");
                System.out.println("j="+j);
                System.out.println("i="+i);
            int f()
                j=12;
                System.out.println("B.f called !!!!");
                return 456;
        public class Demo
            public static void main(String args[])
                B bobj = new B();
    output begin
    B.f called !!!!
    A.A called
    i=0 // BAD here
    B.f called !!!!
    B.B called
    j=12
    i=0 // BAD here
    output end -
    Although the question can be solved! I am still confused: why Java do this? when A's constructor call f(), B is still incomplete!!
    Java is a good language,but I dislike it on this
    Regards.
    Sunway

  • Dear Apple, unfortunately, I think I have found a bug in ios 7. During an incoming call is no call rejection or selection of the ability to send a text message. I hope it is a bug and there is a solution. Thank you very much.

    Dear Apple, unfortunately, I think I have found a bug in ios 7. During an incoming call is no call rejection or selection of the ability to send a text message. I hope it is a bug and there is a solution. Thank you very much.

    Please report via Apple Feedback. These are user forums. You aren't speaking to Apple here.

Maybe you are looking for

  • ITunes stop working when trying to sign out

    I've received the message - iTunes stop working and Windows had to close the program. If I try to view my Apple id account the same occurs.

  • Download file format(different length data on one column)

    Hi all, i am just writing a report to download the delivery data to a file.the file have 3 columns.the length of the column data in every row varies. let my file structure is like first line of my file contains, delivery no(22),delivery date(8),deliv

  • Open Multiple JPEG's at Once in Raw Editor

    Hello Everyone:  Can one open multiple JPEG's at once in the Editior?  When I select File>Open As>Raw Option (I think that is what it says) to open JPEG's or TIFF's in the Raw Editor I can only select one photo at a time.  If I tried to open a group

  • Solaris 10 ldapclient setup question

    Hi all, I'm setting up ldap authentication for ssh logins on a Solaris 10 system. Up to now, I've been successful in finding my answers in: 1 this forum 2 http://www.sun.com/bigadmin/features/articles/nis_ldap_part2.jsp 3 http://web.singnet.com.sg/~g

  • Simultaneous writing of different DAQmx tasks to TDMS files

    Hi, I am using a 6368 to moniter several different voltage readings simultaneously on a circuit. I would like to have each of these channels sampling as close to the 2MS/s limit as possible, while writing the data to disk. From what I've gathered, it