JDBC:  Filling a combobox or listbox from a database

How would I go about populating a combobox or listbox from a database query?
What would the basic steps be? Do I need to create vectors?
Is there a good reference place for this stuff on the Web?
Thanks!

What would the basic steps be? Do I need to create
vectors?possible (not so clean):
1. retrieve a resultset
2. create a model with the set
3. set the model of the listbox or the combobox
4. call repaint
Is there a good reference place for this stuff on the
Web?http://developer.java.sun.com/developer/onlineTraining/
Thanks!

Similar Messages

  • Fill in form with records from a database

    hi using adobe live cycle desginer could some one guide me or tell me what to look for so i can:
    populate my pdf form with records from a ms access database
    my site is in asp
    thanks

    This [url http://forum.java.sun.com/thread.jsp?forum=57&thread=497641]thread should get you started.

  • Passing Data from ComboBox to ListBox.

    Hi everyone, I'm new with the whole flex 2 environment and
    i'm need some help getting data passed from a ComboBox to ListBox.
    I don't know whether i'm going about this the right way. Senario,
    the person using this application will be able to select an item in
    the ComboBox and based on the item selected, the listBox get
    data(using an array variable) assigned to that item in the
    ComboBox. I don't know the syntax that is used to achieve this.
    I'll appreciate any information related to getting this problem
    resolved.

    Thanks for the feedback william, it was helpful but it still
    not entirely what i want the list box and combo box to do. After
    the array has been populated in the list box, a selection of item
    can be made to display further details of the item in the list box.
    A quick question will be can parallel array type be created in
    Flex? Trying to accomplish department phone book. The people can
    select the department and it will show the list of people in that
    department. In the list box a selection of the person can be made
    to display more detailed info about the person as name, phone
    number, job title and etc. So far i'm not able to get the connect
    between the combo and list box to display detail person info. Need
    Help, all suggestions will be greatly appreciated. Here's my code
    so far:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute">
    <mx:Style>
    Panel
    borderStyle: solid;
    headerColors: #e7e7e7, #d9d9d9;
    backgroundAlpha: 100;
    paddingTop: 10;
    </mx:Style>
    <mx:ArrayCollection id="ITpeople">
    <mx:Object>
    <mx:image>images/andrewo.gif</mx:image>
    <mx:name>John Doe</mx:name>
    <mx:title>Weblayout Specialist</mx:title>
    <mx:phonenum>ext. 1028</mx:phonenum>
    <mx:description>IT Department</mx:description>
    </mx:Object>
    </mx:ArrayCollection>
    <mx:ArrayCollection id="Company">
    <mx:Object>
    <mx:comp>IT</mx:comp>
    </mx:Object>
    <mx:Object>
    <mx:comp>Accounting</mx:comp>
    </mx:Object>
    <mx:Object>
    <mx:comp>Customer Service</mx:comp>
    </mx:Object>
    </mx:ArrayCollection>
    <mx:Script>
    <![CDATA[
    import mx.collections.*;
    ]]>
    </mx:Script>
    <mx:Panel layout="absolute" left="10" top="10" right="54"
    bottom="200" title="ICM Phone Directory">
    <mx:ComboBox x="10" y="32" id="cbxCompDept"
    dataProvider="{Company}" labelField="comp" selectedIndex="0" >
    </mx:ComboBox>
    <mx:List id="names" dataProvider="{ITpeople}"
    labelField="name" selectedIndex="0" x="10" y="95" height="268"
    width="165"></mx:List>
    <mx:VBox width="416" y="95" x="206">
    <mx:Image id="picture"
    source="{ITpeople.getItemAt(names.selectedIndex).image}"
    autoLoad="true" />
    <mx:Form id="details">
    <mx:FormItem label="Name: ">
    <mx:Label id="nameInput"
    text="{ITpeople.getItemAt(names.selectedIndex).name}"/>
    </mx:FormItem>
    <mx:FormItem label="Title: ">
    <mx:Label id="titleInput"
    text="{ITpeople.getItemAt(names.selectedIndex).title}"/>
    </mx:FormItem>
    <mx:FormItem label="Phone Number: ">
    <mx:Label id="phoneInput"
    text="{ITpeople.getItemAt(names.selectedIndex).phonenum}"/>
    </mx:FormItem>
    <mx:FormItem label="Department/Company: ">
    <mx:Label id="descInput"
    text="{ITpeople.getItemAt(names.selectedIndex).description}"
    height="120" width="200" />
    </mx:FormItem>
    </mx:Form>
    </mx:VBox>
    </mx:Panel>
    </mx:Application>

  • Problem filling listbox from DB

    Maybe i am totally off by thinking it can be done this way, but i am trying to dynamicaly create a listbox from a DB query. I debugged the server side and the array is being filled in. However when the page displays there is nothing in the box. Can this be done this way?
                  <form id="form2" name="form2" method="post" action="">
                        <select name="select" id="select" style = "width:190px" class="list_effect">
                              <c:forEach var="itemsize" items="${sizes}">
                                    <option value="${itemsize.itemNum}">${itemsize.size}</option>
                              </c:forEach>
                        </select>
                  </form> 

    RAMJANE wrote:
    I thnik if you use
    <c:out value="${itemsize.itemNum}"/>
    <c:out value="${itemsize.size}"/>
    thn problem can be solved.Not needed if you're using at least Servlet 2.4 / JSP 2.0. Then you can just use EL in template text without the need for those c:out tags.

  • Loading a combobox with data from a different domain

    I have filled in a combobox with values from an .asp page and
    have used it
    successfully. The problem is that if the flash file is ran
    from a different
    domain from the load location, the combobox doesn't get
    filled in (as
    apposed to the error if I ran it off of my drive).
    datafeed.asp spits out the appropriate stuff for the AddItems
    function to
    read correctly. (as I has said, it does work). The combobox
    gets filled in
    the development environment (Macromedia Flash MX Professional
    2004) as well
    as flash player.
    But when I upload it to one of my other websites, the data is
    never
    retrieved. Even though that the webserver containing the data
    feed, the
    webserver hosting the flash file and my machine can all read
    datafeed.asp.
    Am I missing a setting that allows a flash file to read data
    from another
    domain?
    The following code has been changed for security reasons. But
    believe me it
    works in its original format.
    myData = new LoadVars();
    myData.onLoad = AddItems;
    myData.load("
    http://www.mydomain.com/datafeed.asp")
    function AddItems() {
    for (i=0; i<numItems; i++) {
    var ProductID = eval("myData.ProductID"+i);
    var ProductName = eval("myData.ProductName"+i);
    var ProductSale = eval("myData.ProductSale"+i);
    var DataProvider = { productid
    roductID, productsale
    roductSale };
    _root.application.chooseproducts.prodlist_cb.addItem(ProductName,
    DataProvider);
    Thank You,
    Julian

    not sure, but this might be what you need...
    //allow loading of files from domain
    System.security.allowDomain("
    http://www.mydomain.com");

  • How to fill bean area with values from database

    i have a bean area in form which act as acombobox autocomplete , i want to fill it with dynamic values from database , any help will be appreciated.
    http://forms.pjc.bean.over-blog.com/article-16369664.html "this is the example i'm working on"
    Best Regards.

    An example with the EMP table:
    DECLARE
      cursor cur is select empno,ename from emp;
    BEGIN
      -- initialise the ComboBox twin values --
      for c in cur loop
       if c.empno is not null then
        Set_Custom_Property('BL.BEAN',1,'ADD_TWIN',c.empno||','||c.ename);
       else
        Set_Custom_Property('BL.BEAN',1,'ADD_TWIN_NULL',c.empno||','||c.ename);
       end if ;
      end loop;
      Set_Custom_Property('BL.BEAN',1,'ADD_TWIN','[END_DATA]');
      Set_Custom_Property('BL.BEAN',1,'SET_ALIGNMENT','right');
    END;Francois

  • How can I fill a table of objects from cursor with select * bulk collect???

    Hi All, I have a TYPE as OBJECT
    create or replace type dept2_o as object (
    deptno NUMBER(2),
    dname VARCHAR2(14),
    loc VARCHAR2(13));
    I can fill a table of objects from cursor with out select * bulk collect...., row by row
    declare
    TYPE dept2_t IS TABLE of dept2_o;
    dept_o_tab dept2_t:=dept2_t();
    i integer;
    begin
    i:=0;
    dept_o_tab.extend(20);
    for rec in (select * from dept) loop
    i:=i+1;
    dept_o_tab(i):=dept2_o(
    deptno => rec.deptno,
    dname => rec.dname,
    loc =>rec.loc
    end loop;
    for k IN 1..i loop
    dbms_output.put_line(dept_o_tab(k).deptno||' '||dept_o_tab(k).dname||' '||dept_o_tab(k).loc);
    end loop;
    end;
    RESULT
    10 ACCOUNTING NEW YORK
    20 RESEARCH DALLAS
    30 SALES CHICAGO
    40 OPERATIONS BOSTON
    But I can't fill a table of objects from cursor with select * bulk collect construction ...
    declare
    TYPE dept2_t IS TABLE of dept2_o;
    dept_o_tab dept2_t:=dept2_t();
    begin
    dept_o_tab.extend(20);
    select * bulk collect into dept_o_tab from dept;
    end;
    RESULT
    ORA-06550: line 6, column 39;
    PL/SQL: ORA-00947: not enough values ....
    How can I fill a table of objects from cursor with select * bulk collect???

    create or replace type dept_ot as object (
    deptno NUMBER(2),
    dname VARCHAR2(14),
    loc VARCHAR2(13));
    create table dept
    (deptno number
    ,dname varchar2(14)
    ,loc varchar2(13)
    insert into dept values (10, 'x', 'xx');
    insert into dept values (20, 'y', 'yy');
    insert into dept values (30, 'z', 'zz');
    select dept_ot (deptno, dname, loc)
      from dept
    create type dept_nt is table of dept_ot
    declare
       l_depts dept_nt;
    begin
       select dept_ot (deptno, dname, loc)
         bulk collect
         into l_depts
         from dept
       for i in l_depts.first .. l_depts.last
       loop
          dbms_output.put_line (l_depts(i).deptno);
          dbms_output.put_line (l_depts(i).dname);
          dbms_output.put_line (l_depts(i).loc);    
       end loop;
    end;
    /

  • I have a question : Someone want sell me Creative Suite 6 MAster Collection, He is gave me the key and want me to fill in the transfer document from adobe? If I accept and pay him for this do I be eligble to use this software in company ? He is offering m

    I have a question : Someone want sell me Creative Suite 6 MAster Collection, He is gave me the key and want me to fill in the transfer document from adobe? If I accept and pay him for this do I be eligble to use this software in company ? He is offering me full version of the product. How Can I check it ?

    There is no reason to do that. You can buy a legitimate copy of the product from Adobe.
    If the price is too good to be true, it's too good to be true. Caveat emptor.

  • HT2506 I am trying to fill out a PDF form from an internet site, but when I go to print it, none of the content prints, only the header of the document.  Help!

    I am trying to fill out a PDF form from an internet site, but when I go to print it, none of the content prints, only the header of the document.  Help!

    Instead of printing it, try saving it as a pdf from the print menu, and then printing the pdf out.

  • Fill out a pdf form from ADF application

    Hi
    I need to fill out a PDF form, from my ADF application and i want to know if exist a component or libarary to do this.
    i hope you can help me
    Regards.

    Hi,
    two options are:
    Oracle BI Publisher (by far best choice but needs to be licenced)
    http://www.oracle.com/technology/pub/articles/vohra-jdev-xmlpub.html
    Jasper Reports, Free but not as functional or easy to use as BIP
    http://jasperforge.org/projects/jasperreports
    Both products have Java API's which you can integrate with your application.
    Brenden

  • I can't email a photo directly from iPhoto.  First, I only have two "themes" to choose from instead of 8, and when prompted to fill in the "to" and "from", the "from" box has "MobileMe" already in it, and I can't get rid of or change it. I have OSXLion

    I can't email a photo directly from iPhoto.  First, I only have two "themes" to choose from instead of 8, and when prompted to fill in the "to" and "from", the "from" box has "MobileMe" already in it, and I can't get rid of or change it. I have OSXLion

    I understand, as that was the place I would change it before 8.3 but now that option of Mail Days to Sync is not available?  Any idea why that would be?

  • Empty CLOB field value from Oracle database using JDBC Sender

    Hi All,
    I am selecting a CLOB field from Oracle database table using JDBC Sender adapter and getting error "NullPointerException"
    Seen SAP note 1283089 but its not applicable for my support pack PI 7.0 SP 12 and client dont want to upgrdate SP 17 right now.
    I tried rpad(1,0)Column_Name funciton in JDBC select query but it selcting blank value for every record even those having some value for this CLOB field so not useful
    Could anybody suggest possible way? client dont want to change anything at database side.
    Thanks,
    Dharamveer

    What is the Oracle driver version installed? You might need to install 10.x driver if not already using it.

  • Migration of multicolumn listbox from 7.1.1 to 8.5

    I recently migrated a VI containing a multicolumn listbox from LV 7.1.1 to LV 8.5. Interestingly the 3D-headers got lost and the hight of the rowes changed.
    Left in the picture is the LV 7.1.1 version and right is the LV 8.5 version. The font is set to Lucida Console 14 bold.
    I got CAR 119444 for this conversion bug.
    Message Edited by waldemar.hersacher on 07-10-2008 09:02 PM
    Waldemar
    Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
    Don't forget to give Kudos to good answers and/or questions
    Attachments:
    multicolumnlistbox.png ‏2 KB

    Hi Vicky,
    No worries my friend
    We have not done this upgrade and do not have any current plans to do so. I am
    always, always, always slow to move along the upgrade path. This may be a bad thing
    but it has saved us some great pain as well over the years. Our current versions are;
    CUCM - 7.1(3b)su2
    CUC - 7.1(3b)su2
    We have found these versions to be very stable. I have spent a fair bit of time looking at people's
    migrations to 8.5(x) here @ CSC and have not seen or heard of too many horror stories. This is one bug you'll
    want to look out for.
    CSCtn61453            Bug Details
    Applying 8.5.1 software as patch results in corrupted CUC installation.
    Symptom:
    After fresh installation of 8.5.1 software, we can notice several problem symptoms.
    - Connection services and Connection DB does not start
    - System cannot be accessed via web page
    - Informix error messages for certain CLI commands
    Example :- show cuc cluster status
    com.informix.asf.IfxASFException: Attempt to connect to database server (ciscounity) failed.
    Command failed
    Conditions:
    It is observed during fresh installation of Unity Connection product when installation was
    started with earlier version of software and 8.5.1 software was applied as a patch during the setup process.
    Workaround:
    First, perform a fresh installation of earlier version of software using the install media. Then after verifying the installation, proceed with the upgrade to 8.5.1 as a separate process.
    Status
    Open            
    Severity
    2 - severe
    Last Modified
    In Last 3 Days        
    Product
    Cisco Unity Connection         
    Technology
    1st Found-In
    8.5(1)ES1
    Best of luck with your changes.
    Cheers!
    Rob

  • Populate Combobox in Excel from SQL Table

    I have a requirement to populate a combobox in excel from a table in SQL when the user opens the excel workbook. Can you help me on how I can do that. I have a supplier column in the table which I like to appear in the combobox and has around 1500 records.
    Excel Version 2010
    SQL Server Version 2008
    Thanks in advance.

    Hi Jaggy99,
    According to your description, you want to implement a combobox for the supplier column when open a SQL Server table in Microsoft Excel, right?
    I have tested it on my local environment, when we connect to a SQL Server database and display the table data in Excel, the excel will populate a drop-down list for each columns as the filter. Here is the screenshot for you reference.
    Regards,
    Charlie Liao
    TechNet Community Support

  • Populating JSF ListBox from DataBase

    Hi,
    im new to JSF and i have a problem populating Listboxes with database values.
    i have 3 listboxes and the 3 are populated from tables in my database.
    I would like to filter the returned(from database) values in the 2nd listbox depending on the value selected in the 1st listox.
    I dont know how to do this.
    BTW i'm usis Ibatis Abator to map the database.
    tnx

    Here is what I think you are wanting to do:
    1. Have the list box show values from a database table.
    2. Have the user make selections. Should the user return to that page later in the session, have the previous selection still selected.
    Normally, you would bind the listbox to the database table, as is shown in http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/databoundcomponents.html. The only reason I can think of for not binding directly to the database table is if there is a possiblity that the database table can change (additions, updates, deletes) during the user's session.
    Are you able to emulate the above tutorial using the Postgress database? It might be good to pinpoint whether the problem is with the Postgress driver or with the code you are writing.
    By the way, if you use a data provider to access the database, as shown in the tutorial, here is how you iterate through the data
            try {
                myDataProvider.cursorFirst();
                do {
                    [build your options list here]
                } while (myDataProvider.cursorNext());
            } catch (Exception ex) {
                error("put your message here" +
                        ex.getMessage());
                log("put your message here: " +
                        ex.getMessage(), ex);
            }You are correct to bind the selected property to a session bean property in order to perserve the user selecitons through the user's s session.

Maybe you are looking for

  • BSEG: Issue in executing in Background

    Hi, I am trying to pull out data for 2 months from BSEG table. I selected Settings --> List Format --> Choose Fields and selected the required firelds along with Amount and Customer Field. I execute it in Background. In SM37, I got the spool. But the

  • Ok, dummy alert...

    Hi people... I use DJ1800 (dj1800.com) to mix at home. I like doing my little bedroom mixes to play on my iPod-saves me buying mixed CD's every year with the same stuff on-i just make a really good one from the off . I used to use my iMic on my old i

  • I can't import Cds. it kinda *****

    I think I have done everything with my Gateway to try to get iTunes to recognize Cd's. Updated itunes. deleted invisible drives. changed some registry files. any ideas?

  • My Number One Motion 3 request

    This is a so near yet so far problem I currently have with Motion 2.12. It makes it very tough for me to convince broadcast professionals to use Motion in their workflows. Motion 2.12 will import all layers of a Photoshop file as separate objects and

  • Need help with a regex

    Is there a way to make a regex which matches one of two particular words? I've designed a method which acts as a prompt for user input. It accepts 3 parameters, all Strings: the first a description of the prompt (e.g. "Enter Date:"), the second a reg