Adding Selected value in JTable

hi ,
I want to put the file selected via the filechooser browse dialog and put it in the table.can someone help me plz?

To get better help sooner, post a SSCCE that clearly demonstrates your problem.
To post code, use the code tags -- [code]Your Code[/code] will display asYour CodeOr use the code button above the editing area and paste your code between the {code}{code} tags it generates.
Based on your post, I can only point you to JTable#setValueAt(Object aValue, int row, int column)
db

Similar Messages

  • Selecting values in JTable

    I have a jtable with 5 columns and 5 rows (the fifth column is hidden using removeColumn)
    col1----col2----col3----col4----col5
    aaa------xxx----xxx----xxx-----5
    asd----asds---asds----dsd-----*6*
    zxx---asds--zxxzc----zxcxc---*2*
    zxc---zxcx---xcxc---xcx-------*3*
    edfs---efdd----ccv---xzcxc-----1
    if I put my mouse/select row 3
    i can use tablex.getModel().getValueAt(tablex.getSelectedRow(), 4))
    Which gives me the value 2
    However, I have implemented a table sorter..
    If I sort the values using the column and select again row 3, the value returned by
    tablex.getModel().getValueAt(tablex.getSelectedRow(), 4)) is still 2.. which is not what is displayed!
    I think it is still getting the values of the original tablemodel and that the sorting is only for displaying purposes
    if I use tablex.getValueAt(tablex.getSelectedRow(), 4) , I get an error since column 4 (the fifth column is hidden)
    Please help, how do I get the desired value of the hidden field even if I use sorter..
    Thanks

    Read the JTable API and search for "convert" for an explanation how this works and for the methods to use.

  • How do I get a  value of a  cell when user selects in a JTable?

    Hi everybody,
    I need some help in order to complete my task. I 've a JTable. When user selects any particular column . I should able to get user selected value. I added a MouseListener to the table. And I 've written the following code - in mousePressed()
    JTable table = (JTable) e.getSource();
    iint col =JTablePartNumbers.getInstance().getSelectedColumn();
    int row = JTablePartNumbers.getInstance().getSelectedRow();
    System.out.println("row col value" +JTableModelPartNumbers.getInstance().getValueAt(row,col));
    I'm getting col and row value but when I'm using TableModel.getValue(row,col) - it is giving me null value.
    And my getValueAt() method is defined as
    public Object getValueAt( int nRow, int nCol )
         System.out.println("the nRow" nRow "And nCol " nCol "And row count" + getRowCount());
         int rowCount = getRowCount();
         System.out.println("the row count" +rowCount);
    if ( ( nRow < 0 ) || ( nRow >= getRowCount() ))
         return null;
              // Taking
              StartNewRevisedGenericSGMLFragmentsModel row = (StartNewRevisedGenericSGMLFragmentsModel) partNumberDetails.elementAt( nRow );
         //     System.out.println("row value" nRow "Col value" +nCol);
              switch ( nCol )
                   case 0:
                   return row.getParNo();                               case 1:
                        return row.getRev(); // gets model data
                   case 2:
                        return row.getDoneDate( );// gets revision data
              Vector rowVec = (Vector) partNumberDetails.get(nRow);
         return (String) rowVec.get(nCol);
    so please help me out resolving this problem.
    Thanks in advance
    purnima

    try calling jtable.getSelectionModel().addListSelectionListener(...)
    by the way, any good design of a generic UI Table must have a feature to do what you're talking about in an easy way. If it didn't, why would anyone use it?

  • Equipment Partner added but not in characteristic selection values

    Hi,
    I want to ask some tips here because in the equipment master, a partner was added (as an operator) but when we try to add that partner as the driver (characteristic) it is not in the selection. What could be the possible causes of the data not flowing to the selection values whilst it has been added already as a partner and HR confirmed that the record is already in their master data.
    rgds,
    jay

    Eugene,
    My apologies. here's the answers.
    do you see the strange data in the master data of the IO?
    I am not able to see tha master data in the IO. In the config of the IO, the "With Master Data" option is unchecked.
    The IO is used in a number of cubes. So in order to try and see if the values came from transaction data, I went to each of those cubes and ran a quick check of the infocube contents. I focused the search on one of the "incorrect" values. (The volume of data in the cubes is enormous). I did not get any results from this search.
    can you suggest anything more I can do?
    best regards,
    Allan

  • Copy select value in the textfield from LOV and allow user to edit it

    Hi,
    I have a datablock with 20 records and each record has comments (say field_comments) fields. I would like to allow user to choose predefined comments populated from LOV (say lov_comments) and to append some extra comments after they choose the value from LOV.
    I have created a LOV and added Return type “field_comments” in the column mapping properties. When user clicks on a button, LOV opens up. They select the value from the LOV and the value goes to “field_comment” field. The problem with this approach, user can’t add their comment after selecting from LOV.
    I tried this way too. I created another non-visible textbox (say dummy). In the LOV, I added “dummy” field as returntype. In the dummy field, I have created “POST-CHANGE” trigger which basically says :block. field_comments = :block. Dummy.
    But, the user has to click on other field to view the selected value from the LOV. The values in the “field_comments” is not updated as soon as user click on “OK” button in the LOV.
    I would appreciate it if somebody could give me some input and help to solve my issue. Thank you for your help.
    Thank.

    Well, I tried exactly what you posted and it allowed me to SELECT from LOV and then CHANGE/APPEND new text in front of returned value in the field. It saved to the database and queried without any problems.
    Is your item allowed to INSERT/UPDATE ? If not, then set "Update/Insert Allowed" properties to Yes and attach your LOV to the item and set "Validate from list" to No.
    You may also see if you have any validation being performed on WHEN-VALIDATE-ITEM or POST-CHANGE trigger which will fail since you are editing the values populated from LOV.
    Hope it helps!

  • Af:table and selectOneChoice, creating a new row resets selected value

    Hello,
    I have a table containing 4 columns, first two are read-only (outputtext) and next 2 contains selectOneChoice , table model is baed on java.util.List
    adding a new row, works fine but it resets the selectOneChoice(dropbox) selected value to First Index For All Rows
    so everytime you add a new row, it resets the value to the very First Value in the dropbox for all rows,
    it seems after PPR it loses the selected value in SelectOneChoice for each row...
    any ideas?
    Thanks,

    Hi,
    What is the EL expression given for value property of selectOneChoice list?
    I guess it is the bean variable and it is same for each row, due to which selection in any selectOneChoice list in table modifies the same bean variable and sets the same value for lists in all other rows too(same happens in case of new insertion also, when you insert new record selectonechoice list points to the first value if no selection item is not added), in case of selectonechoice list you need to handle the selected values differently for each row. If you can share sample code, I can tell you what could be the problem.
    Sireesha

  • How to get the default selection color from JTable

    Hi, there,
    I have a question for how to get the default selection color from JTable. I am currently implementing the customized table cell renderer, but I do want to set the selection color in the table exactly the same of default table cell renderer. The JTable.getSelectionBackgroup() did not works for me, it returned dark blue which made the text in the table unreadable. Anyone know how to get the window's default selection color?
    Thanks,
    -Jenny

    The windows default selection color is dark blue. Try selecting any text on this page. The difference is that the text gets changed to a white font so you can actually see the text.
    If you don't like the default colors that Java uses then use the UIManager to change the defaults. The following program shows all the properties controlled by the UIManager:
    http://www.discoverteenergy.com/files/ShowUIDefaults.java
    Any of the properties can be changed for the entire application by using:
    UIManager.put( "propertyName", value );

  • How i insert the values in JTable

    Hi,
    Iam new to the swings i have a problem placing the values in JTable while retriving the values from DataBase .Anybody please suggest me..
    i can retriving the values but how i place the vlaues..
    This is My code
    package com.teamone.healthcare;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.sql.DriverManager;
    import java.sql.Statement;
    import javax.swing.JButton;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.WindowConstants;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.TableModel;
    import com.mysql.jdbc.Connection;
    import com.mysql.jdbc.ResultSet;
    * This code was edited or generated using CloudGarden's Jigloo
    * SWT/Swing GUI Builder, which is free for non-commercial
    * use. If Jigloo is being used commercially (ie, by a corporation,
    * company or business for any purpose whatever) then you
    * should purchase a license for each developer using Jigloo.
    * Please visit www.cloudgarden.com for details.
    * Use of Jigloo implies acceptance of these licensing terms.
    * A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
    * THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
    * LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
    public class ClientList extends javax.swing.JFrame {
         private static final long serialVersionUID = 1L;
         private JScrollPane list;
         private JButton view;
         private JButton close;
         private JTable jTable1;
         Connection con = null;
        Statement st = null;
        ResultSet rs = null;
         * Auto-generated main method to display this JFrame
         /*public static void main(String[] args) {
              ClientList inst = new ClientList();
              inst.setVisible(true);
         public ClientList() {
              super();
              initGUI();
              this.setVisible(true);
         private void initGUI() {
              try {
                        list.setBounds(161, 133, 371, 98);
                        list.getHorizontalScrollBar().setPreferredSize(new java.awt.Dimension(10, 59));
                   setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
                   getContentPane().setLayout(null);
              try {
                    Class.forName("com.mysql.jdbc.Driver").newInstance();
                    con = (Connection) DriverManager.getConnection("jdbc:mysql:///healthcare","yenmad","yenmad");
                    st = con.createStatement();
                    rs = (ResultSet) st.executeQuery("SELECT User_id, Username, Citizen_ID, First_Name, Phone FROM register_users");
                    while(rs.next()) {
                      int Userid = rs.getInt(1);
                      String Username = rs.getString(2);
                      String ClientId = rs.getString(3);
                      String ClientName = rs.getString(4);
                      //String Last_Name = rs.getString(5);
                      String ContactNumber = rs.getString(5);
                      System.out.println(Userid + ", " + Username + ", " +ClientId  + "," + ClientName +","+ContactNumber);
                  } catch (Exception e) {
                       System.out.println("Exception: " + e.getMessage());
                        list = new JScrollPane();
                        getContentPane().add(list);
                        list.setBounds(0, 0, 644, 217);
                             TableModel jTable1Model = new DefaultTableModel(
                                  new String[][] { { "", "", "","", "" } },
                                  new String[]{ "UserId", "UserName", "ClientId", "ClientName", "ContactNumber"});
                             jTable1 = new JTable();
                             list.setViewportView(jTable1);
                             jTable1.setModel(jTable1Model);
                        close = new JButton();
                        getContentPane().add(close);
                        close.setText("Close");
                        close.setBounds(518, 231, 63, 28);
                        view = new JButton();
                        getContentPane().add(view);
                        view.setText("View");
                        view.setBounds(441, 231, 63, 28);
                        view.addActionListener(new ActionListener() {
                             public void actionPerformed(ActionEvent evt) {
                                  viewActionPerformed(evt);
                   pack();
                   this.setSize(652, 300);
              } catch (Exception e) {
                   e.printStackTrace();
         private void viewActionPerformed(ActionEvent evt) {
              System.out.println("view.actionPerformed, event=" + evt);
              new ViewClient();
    }

    can i display this table values in vertical .. if yes how can i do that.. please suggest me..
    this is the code iam using but it is displa in horizontally...
    package com.teamone.healthcare;
    import java.awt.BorderLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.sql.DriverManager;
    import java.util.Vector;
    import javax.swing.JButton;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.WindowConstants;
    import com.mysql.jdbc.Connection;
    import com.mysql.jdbc.ResultSet;
    import com.mysql.jdbc.ResultSetMetaData;
    import com.mysql.jdbc.Statement;
    public class ClientList extends javax.swing.JFrame {
         private static final long serialVersionUID = 1L;
         /*public static void main(String[] args) {
              ClientList inst = new ClientList();
              inst.setVisible(true);
         public ClientList() {
              super();
              initGUI();
              this.setVisible(true);
         private void initGUI() {
              try {
                   setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
                   pack();
                   setSize(600, 500);
                   Vector columnNames = new Vector();
                Vector data = new Vector();
                try
                          this.setSize(500, 400);
                      //  Connect to the Database
                      Class.forName("com.mysql.jdbc.Driver");
                      Connection connection = (Connection) DriverManager.getConnection("jdbc:mysql:///healthcare","yenmad","yenmad" );
                      //  Read data from a table
                      String sql = "Select User_id, Username, Citizen_ID, First_Name, Last_Name, Phone from register_users";
                      Statement stmt = (Statement) connection.createStatement();
                      ResultSet rs = (ResultSet) stmt.executeQuery( sql );
                      ResultSetMetaData md = (ResultSetMetaData) rs.getMetaData();
                      int columns = md.getColumnCount();
                      //  Get column names
                      for (int i = 1; i <= columns; i++)
                       columnNames.addElement( md.getColumnName(i) );
                      //  Get row data
                      while (rs.next())
                            Vector row = new Vector(columns);
                            for (int i = 1; i <= columns; i++)
                                  row.addElement( rs.getObject(i) );
                            data.addElement( row );
                      rs.close();
                      stmt.close();
                catch(Exception e)
                      System.out.println( e );
                //  Create table with database data
                JTable table = new JTable(data, columnNames);
                JScrollPane scrollPane = new JScrollPane( table );
                getContentPane().add( scrollPane );
                JPanel buttonPanel = new JPanel();
                getContentPane().add( buttonPanel, BorderLayout.SOUTH );
                buttonPanel.setPreferredSize(new java.awt.Dimension(200, 66));
                        JButton View = new JButton();
                        buttonPanel.add(View);
                        View.setText("View");
                        View.setLayout(null);
                        View.addActionListener(new ActionListener() {
                             public void actionPerformed(ActionEvent evt) {
                                  ViewActionPerformed(evt);
                        JButton Close = new JButton();
                        buttonPanel.add(Close);
                        Close.setText("Close");
                        Close.addActionListener(new ActionListener() {
                             public void actionPerformed(ActionEvent evt) {
                                  CloseActionPerformed(evt);
                        } catch (Exception e) {
                   e.printStackTrace();
         private void CloseActionPerformed(ActionEvent evt) {
              System.out.println("Close.actionPerformed, event=" + evt);
              this.setVisible(false);
         private void ViewActionPerformed(ActionEvent evt) {
              System.out.println("View.actionPerformed, event=" + evt);
              new ViewClient();
    }

  • How to select value of selectOneChoice

    Hello,
    First of all I want to describe what I want to do and then the preconditions for my case.
    What I want to do:
    I simply want a <selectOneChoice> Component which represents an enumeration of values.
    In database there is a column which has the value 'A' or 'P'.
    In the DataTransferObject´s mentioned below these values are represented with Character objects.
    If the DataTransferStructure mentioned below is loaded I want the <selectOneChoice> to display the current value originate from database.
    If I submit the DataTransferStructure (or DataTransferObject --> see below) I want that the selected value (of <selectOneChoice>) will be written to database.
    Preconditions:
    ADF BusinessComponenets are not used.
    Only ADF Faces and Bindings are used.
    I have defined a Bean wich executes functions over RMI on EJBs.
    This bean is used as DataControl to bind their return values to pages.
    It looks nearly like following class:
    public class FunctionalObjectServiceBean{
         public FunctionalObjectServiceBean() {
    public DataTransferStructure readObjectWithId(Long Id)
    throws Exception{
    DataTransferStructure has link to> DataTransferObject
    DataTransferObject has attribute> Character attributeA (with either value 'A' or 'P')
    I have defined a selectOneChoice in the jspx.
    DataTransferObjectAttr1 is an Iterator-Binding to the matching attribute in DataTransferObject.
    value="#{bindings.DataTransferObjectAttr1.inputValue}" should select the appropriate value originating from database on load.
    <af:selectOneChoice value="#{bindings.DataTransferObjectAttr1.inputValue}"
    label="#{bindings.DataTransferObjectAttr1.label}"
    required="#{bindings.DataTransferObjectAttr1.hints.mandatory}"
    shortDesc="#{bindings.DataTransferObjectAttr1.hints.tooltip}"
    id="soc1"
                                       valuePassThru="true">
    <af:selectItem label="Active" value="A" id="si1"/>
    <af:selectItem label="Passive" value="P" id="si2"/>
    </af:selectOneChoice>
    When I try to execute this example following errors occur:
    <FacesCtrlListBinding> <getInputValue> ADFv: In der Werteliste wurden keine gewählten Elemente gefunden, die mit dem Wert A des Typs java.lang.Character übereinstimmen.
    <Utils> <buildFacesMessage> ADF: Adding the following JSF error message: Erstellen eines Objekts vom Typ java.lang.Character aus Typ java.lang.String mit dem Wert A nicht möglich
    oracle.jbo.domain.DataCreationException: JBO-25009: Erstellen eines Objekts vom Typ java.lang.Character aus Typ java.lang.String mit dem Wert A nicht möglich
    Using converters has also no effect here.
    thanking you in anticipation

    I try to translate it in my words:
    <FacesCtrlListBinding> <getInputValue> In the value list no elements were found which match the value A with datatype java.lang.Character.
    <Utils> <buildFacesMessage> ADF: Adding the following JSF error message: Creating object of type java.lang.Character from source type java.lang.String not possible.
    oracle.jbo.domain.DataCreationException: JBO-25009: Cannot create an object of type:java.lang.Character from type:java.lang.String with value: A.

  • I want to add radio button selected value in shopping cart

    hi
    i am new to java
    and i am doing shopping cart project
    and i want to aad radio button selected value in cart but only one value.
    i am doing that in jsp.
    when iam adding that value the name of radio button is printed.
    and in remove page nothing displyed
    pls help me
    Thanks in advance.
    my code is-
    index.jsp
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    <html>
    <head>
    <title>Shopping cart</title>
    <style>
    * { font-size: 12px; font-family: Verdana }
    input { border: 1px solid #ccc }
    </style>
    </head>
    <body>
    <jsp:declaration>
    java.util.Enumeration parms;
    java.util.Enumeration values;
    </jsp:declaration>
    <jsp:scriptlet>
    parms = request.getParameterNames();
    values = request.getParameterNames();
    while(parms.hasMoreElements()) {
    String name = (String) parms.nextElement();
    String value = (String) values.nextElement();
    session.setAttribute(name, value);
    </jsp:scriptlet>
    <img src="images/add.png" onclick="document.location='index.jsp'">
    <img src="images/remove.png" onclick="document.location='remove.jsp'">
    <img src="images/cart.png" onclick="document.location='cart.jsp'">
    <h2>Add to shopping cart</h2>
    <form method="POST" action="index.jsp">
    <table>
    <tr>
    <td><input type="radio" name="radio" value="$10.00" checked></td>
    <td>$10.00</td>
    </tr>
    <tr>
    <td><input type="radio" name="radio" value="$15.00"></td>
    <td>$15.00</td>
    </tr>
    <tr>
    <td><input type="radio" name="radio" value="$20.00"></td>
    <td>$20.00</td>
    </tr>
    <tr>
    <td><input type="radio" name="radio" value="$25.00"></td>
    <td>$25.00</td>
    </tr>
    <tr>
    <td><input type="radio" name="radio" value="$30.00"></td>
    <td>$30.00</td>
    </tr>
    <tr>
    <td><input type="radio" name="radio" value="$35.00"></td>
    <td>$35.00</td>
    </tr>
    </table>
    <br><br>
    <input type="submit" value="submit">
    </form>
    </body>
    </html>
    cart.jsp
    <html>
    <head>
    <title>Shopping cart</title>
    <style>
    * { font-size: 12px; font-family: Verdana }
    </style>
    </head>
    <body>
    <jsp:declaration>
    java.util.Enumeration parms;
    </jsp:declaration>
    <img src="images/add.png" onclick="document.location='index.jsp'">
    <img src="images/remove.png" onclick="document.location='remove.jsp'">
    <img src="images/cart.png" onclick="document.location='cart.jsp'">
    <h2>The shopping cart</h2>
    <jsp:scriptlet><![CDATA[
    java.util.Enumeration content = session.getAttributeNames();
    while (content.hasMoreElements()) {
        out.println(content.nextElement());
        out.println("<br>");
    ]]></jsp:scriptlet>
    </body>
    </html>
    remove.jsp
    <html>
    <head>
    <title>Shopping cart</title>
    <style>
    * { font-size: 12px; font-family: Verdana }
    input { border: 1px solid #ccc }
    </style>
    </head>
    <body>
    <jsp:declaration>
    java.util.Enumeration parms;
    </jsp:declaration>
    <jsp:scriptlet>
    parms = request.getParameterNames();
    while(parms.hasMoreElements()) {
    String name = (String) parms.nextElement();
    session.removeAttribute(name);
    </jsp:scriptlet>
    <img src="images/add.png" onclick="document.location='index.jsp'">
    <img src="images/remove.png" onclick="document.location='remove.jsp'">
    <img src="images/cart.png" onclick="document.location='cart.jsp'">
    <h2>Remove items from cart</h2>
    <form method="get" action="remove.jsp">
    <table>
    <% if (session.getAttribute("$10.00") != null) { %>
    <tr>
    <td><input type="radio" name="radio"></td><td>$10.00</td>
    </tr>
    <% } %>
    <% if (session.getAttribute("$15.00") != null) { %>
    <tr>
    <td><input type="radio" name="radio"></td><td>$15.00</td>
    </tr>
    <% } %>
    <% if (session.getAttribute("$20.00") != null) { %>
    <tr>
    <td><input type="radio" name="radio"></td><td>$20.00</td>
    </tr>
    <% } %>
    <% if (session.getAttribute("$25.00") != null) { %>
    <tr>
    <td><input type="radio" name="radio"></td><td>$25.00</td>
    </tr>
    <% } %>
    <% if (session.getAttribute("$30.00") != null) { %>
    <tr>
    <td><input type="radio" name="radio"></td><td>$30.00</td>
    </tr>
    <% } %>
    <% if (session.getAttribute("$35.00") != null) { %>
    <tr>
    <td><input type="radio" name="radio"></td><td>$35.00</td>
    </tr>
    <% } %>
    </table>
    <br><br>
    <input type="submit" value="submit">
    </form>
    </body>
    </html>

    i used this where park .visits is the java class for
    visit object that contains getResort() method
    now error has gone but nothing is stored in the
    actionform class I would take that to mean the List
    1. does not contain a collection of Visit. You can check that by printing some debug statements inside the loop
    2. contains collection of visit objects. However the visit objects return null for getResort().
    Why dont you debug by printing out the objects from wherever you sit it in request/session scop (i.e in your servlet/web-handler)
    ram.

  • Adding select box in CFgrid

    Hi,
    like datagrid in dotnet,is it possible to add selectbox in cfgrid and also capturing events of selectbox.
    Advance Thanks,

    not sure about capturing events, but here's a
    sample bit of code for adding select drop-down:
    <!--- sample select, i.e.drop-down box --->
        <cfgridcolumn name="Fee" header="Fee" select="yes" values="10,15,20,25" valuesdisplay="10,15,20,25">
    hope that helps.

  • [SOLVED] - Clear SelectManyChoice selected values

    I am using JDeveloper 11.1.1.3.
    I have a selectManyChoice on multiple pages throughout my app. Some selectManyChoice utilize the same Iterator.
    Scenero 1 :
    I go to a page A, select values from the selectManyChoice drop down, and click a commandButton to execute code in the backing bean (to iterate over the selected values and build a whereClause).
    I then navigate to page B (which utilizes the same Iterator). The selectManyChoice drop down, on Page B, has the same values checked that were checked on page A.
    Scenero 2 :
    If I select values on page A and do not click the commandButton, then the values are NOT checked when I navigate to page B.
    How do I clear checked values in a selectManyChoice drop down?
    Edited by: Kennith B on Mar 16, 2011 12:17 PM
    Edited by: Kennith B on Mar 16, 2011 12:17 PM

    I was nulling out the selected values using the setValue() on the component; however, the selected values were still being displayed on the screen. To actually null out and make the selected values disappear from the screen , I had to set the value binding of the selectManyChoice (#{bindings.Category.inputValue}) to null. The code is below:
    <b>Code in JSFUtils</b>
        public static void setExpressionValue(String expression,
                                              Object newValue) {
            FacesContext ctx = getCurrentFacesContext();
            Application app = ctx.getApplication();
            ExpressionFactory elFactory = app.getExpressionFactory();           
            ELContext elContext = ctx.getELContext();                  
            ValueExpression valueExp = elFactory.createValueExpression(elContext, expression, Object.class);
            valueExp.setValue(elContext, newValue);
    }<b>Code in backing bean</b>
      public void doClear_action(ActionEvent actionEvent) {
        JSFUtils.setExpressionValue("#{bindings.Category.inputValue}", null);
      }<b>Code in JSPX</b>
                          <af:selectManyChoice value="#{bindings.Category.inputValue}"
                                               label="Category"
                                               binding="#{backingBeanScope.backing_reports_openDispatchRequests.smc1}"
                                               id="smc1"
                                               contentStyle="width:800.0px;"
                                               valuePassThru="true">
                            <f:selectItems value="#{bindings.Category.items}"
                                           binding="#{backingBeanScope.backing_reports_openDispatchRequests.si1}"
                                           id="si1"/>
                          </af:selectManyChoice>
                          <af:commandButton text="Clear"
                                          binding="#{backingBeanScope.backing_reports_openDispatchRequests.cb3}"
                                          id="cb3"
                                          actionListener="#{backingBeanScope.backing_reports_openDispatchRequests.doClear_action}"/>Also, the value binding needs to be initialized on page load when switching between pages that utilize the same Iterator . When values are selected and the clear button is not clicked, then the values will be displayed on all pages that utilize that Iterator.
    To correct this, the following code needs to be added to the accessor of the selectManyChoice component:
    public RichSelectManyChoice getSmc1(){
        JSFUtils.setExpressionValue("#{bindings.Category.inputValue}", null);
    }Edited by: Kennith B on Mar 16, 2011 12:39 PM
    Edited by: Kennith B on Mar 16, 2011 1:01 PM

  • Combo select value

    I have a problem with comobox select. I have build a form with 3 comboboxes. I added to the form a button for clear all the controls values in the form. When I am in the find mode nad i want to clear the combobox selected value it does not clear the value. and this is only when I am in find mode.
    I have also added the empty value to the combo datasource.
    the code is something like this:
    oCombo.Select(string.Empty, SAPbouiCOM.BoSearchKey.psk_ByValue);
    string selectedValue = _cmbCausale.Selected.Value;
    The problem is that  when I am in find mode the selectedValue it is not string.Empty but it is the last selected value from the form.
    does any one have any suggestion?

    HI,
    Set the datasource value to clear the combobox, then it will work.
    Regards
    J.

  • CF8 bound CFSelects setting selected value

    Hi,
    I have two CFSelects with one bound to the other. The first CFSelect is bound to a query and the second is bound to a cfc and references the first CFSelect.. From what I've been reading, in CF8 you can't set the selected value of a CFSelect bound to a CFC. This is problematic when I'm populating a form with data. I need to be able to set the selected value of the pulldown based on form data. Can anyone provide some insight as to how I might accomplish this.
    So when my form populates, the first CFSelect does set the selected value, but in doing so causes the second CFSelect to go and fetch data. I can't find a way to get the second CFSelect to set the selected value.

    Af course the Iterator is executed when the page loads since it is executable in PageDef. And it is setting the first value as a selected value. The unselectedLabel="empty" is adding new row in the drop down but that row (value) is not part of the iterator. The Iterator is not aware of that new value.
    Than why the framework let me add unselectedlabel (which) is new row in the list but I can not work with it (set it in the drop down programatically - initially)?
    What is more strange:
    public void customer_ValueChangeListener(ValueChangeEvent valueChangeEvent) {
    Object n = valueChangeEvent.getNewValue();
    value n in ValueChangeListener = null when "empty" value is selected (or the index of the selected row 0,1,2.. for any other selection)
    BUT the UI Binding value is not reset to null when "empty" value is selected:
    Object bind = facility_Binding.getValue();
    This bind value is holding the index of the selected row 0,1,2...(the same as above).
    But when the "empty" value is selected, this bind value is holding the old index. So they are out of sinc.
    <af:selectOneChoice value="#{bindings.AdFacilitiesLOV1.inputValue}" label="Facility:"
    shortDesc="#{bindings.AdFacilitiesLOV1.hints.tooltip}" id="soc1"
    unselectedLabel="empty" binding="#{pageFlowScope.GistExportBacking.facility_Binding}"
    autoSubmit="true"
    valueChangeListener="#{pageFlowScope.GistExportBacking.facility_ValueChangeListener}"
    partialTriggers="exp" disabled="#{bindings.FacilityFilter != 'Y'}">
    <f:selectItems value="#{bindings.AdFacilitiesLOV1.items}" id="si1"/>
    </af:selectOneChoice>
    Any solution of my problem?

  • Validating  JCombox value inside JTable

    Hi people.
    I have such a task I can't complete without your help.
    I have a JTable with JComboboxes attached as cell editors, just like in the tutorial.
    JCombos are editable, so user can select value or type something.
    My task is to evaluate what value the user is typed manualy, and if he typed something wrong roll back the editing.
    I don't really know from what point should I start...
    I know how to track chamges during ItemSelect, but got no idea how to track manual input and how to rollback it.
    Edited by: Crosswinder on Aug 27, 2010 12:11 AM

    If you want to keep the editor open, override stopCellEditing() in the CellEditor and return false on a invalid value.
    Or you can ignore the invalid value in TableModel#setValueAt().

Maybe you are looking for

  • 8.1.6 installation failed on RH6.2

    When I try to launch runInstaller, I see only gray rectangle and no more. In "top" I see 8 or 9 instancies of jre, wich take up to 100% of CPU time. When I append to the jre script option -v (for verbose output) I see messages about loading different

  • Why is everything pixelated and blurry in CS6?

    Hi, A few months ago I installed the trial versions of Adobe Indesign, Illustrator and Photoshop on my MacBookPro.  After they expired I purchased the standard student edition and used the provided key number to unlock the full versions.  However, ev

  • Linksys WVC554GCA Wireless Issue

    Hello, I cannot connect wirelessly to my WVC554GCA camera. The wired connection works without issue. Here's my configuration: 1. Security set for WPA/WPA2 personal. The same passphrase is used on the camera and airport extreme. 2. A static IP was ass

  • How do I download Go To Meeting and Fuze on my Macbook pro?

    How do I dfownload "Go To Meeting" and "Fuze" on my Macbook Pro.....Can't find in App store...except for iPad and iPhone. Please advise.

  • Tell me your YMC experiences

    Disabling the YMC service has been a useful fix for many problems on the Yoga 13 (and possibly other Yoga models).  This worked great for me.  The interesting thing is that I have read that for some people, after disabling the YMC service, their Yoga