listbox problem in jsp

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mvkkris
    New Member
    • Oct 2007
    • 1

    listbox problem in jsp

    Hi,

    I have a listbox in my application and if i gave some value and click on search and the values in the database automatically populate in the textbox and dropdown boxes as well as list box. but in case of list box, as we know in the list box we can select multiple values at a time and can store into the database and in my case, while i click on search, multiple values need to select on the list box automatically. what i did was

    [CODE=java]String SqlStrAtOfc = "select distinct(trim(o fi.name)) as office from attendanceuser atr,office ofi where ofi.id=atr.offi ce_id and atr.loginname=' dfsdfg'

    ResultSet rs3 = stmt.executeQue ry(SqlStrAtOfc) ;

    while(rs3.next( ))
    {

    for(int i=0;i<rs3.getRo w();i++)
    {

    strOffice += "<option value=" + "'" + rs3.getString(" office") + "' Selected >" + rs3.getString(" office") + "</option>";

    break;
    }
    }[/CODE]


    the above code gives partially results, can anyone please suggest the exact way to implement.
    Last edited by Ganon11; Oct 27 '07, 04:04 PM. Reason: Please use the [CODE] tags provided.
  • Ganon11
    Recognized Expert Specialist
    • Oct 2006
    • 3651

    #2
    Please take the time to read any stickies you find in any forum. For example, if you had read the first or second sticky in this forum, you would have seen the title, "DO NOT POST QUESTIONS HERE". Whoops! You probably meant to post your question in the Java Forum, not Java Articles, so I'll move it there.

    Comment

    Working...