Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8796465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:37:46+00:00 2026-06-13T23:37:46+00:00

I have multiSelect drop down on my web page designed in JSP. End user

  • 0

I have multiSelect drop down on my web page designed in JSP. End user will select required options and save the form to Database. Below is the original Dropdown that gets values and index from Database Master Table. Selected values are saved in another table.

Original Dropdown on the page.

 <table>
 <tr>
 <td> Departments Impacted   </td>
    <td><select multiple="multiple" name="abc" id="abc">
     <%

         Statement stt3 = conn.createStatement();
         ResultSet rstt3 = stt3.executeQuery("SELECT DEPT_DEPARTMENT_ID, DEPT_NAME FROM [PA].[dbo].[PA_DEPT_DEPARTMENT] ORDER BY DEPT_NAME ASC");
         while (rstt3.next()) {

         %>

         <option value="<%=rstt3.getString(1)%>"><%=rstt3.getString(2)%>
         </option>
         <%
             }
            stt3.close();
     rstt3.close();
                            %>
    </select></td>  </tr>

Below code retrieve saved database values and display them as selected in new select tag. However, I want the selected values to be show in above table instead of new Dropdown.

<%
 ArrayList al = new ArrayList();    
 String dept = null;
 String deptID = "SELECT DEPARTMENT_ID FROM  [PA_RD_DEP_REQ_DETAILS_DEPARTMENT_MAP] inner join  [PA_RD_REQUISITION_DETAILS] on RD_DEP_RD_ID=RD_ID where RD_ID=?";

         PreparedStatement pst4 = conn.prepareStatement(deptID);
         pst4.setString(1, RD_ID);
         ResultSet rstt1 = pst4.executeQuery();
         while (rstt1.next()) {
             dept=rstt1.getString(1);
            al.add(dept);

         }
         for(int i=0; i<al.size(); i++)
         {
         String deptName = "SELECT [DEPT_NAME] FROM  [PA_DEPT_DEPARTMENT] WHERE [DEPT_DEPARTMENT_ID]=?";
         PreparedStatement pst5 = conn.prepareStatement(deptName);
         pst5.setString(1, (String)al.get(i));
         ResultSet rstt5 = pst5.executeQuery();
         while (rstt5.next()) {
             %>
             <option value="<%=(String)al.get(i)%>" selected="selected"><%=rstt5.getString(1)%>
             <%  


         }
         }


         %>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:37:47+00:00Added an answer on June 13, 2026 at 11:37 pm

    Adding the selected attribute, to an option tag will make it selected. This can be done for multiple option tags, without the need for JavaScript:

    <select multiple="multiple">
      <option selected="selected" value="volvo">Volvo</option>
      <option selected="selected" value="saab">Saab</option>
      <option value="vw">VW</option>
      <option value="audi">Audi</option>
    </select>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have multi-select drop down list where in user can select multiple options, now
I have a page with several multiselect drop-down menus. Each menu has a general
I have a multi-select drop down as following, where I have selected the options
I have a drop down that filters a multi-select box that then the user
I have two multiselect <select multiple=multiple name=cselect id=cselect class=required style=width: 240px;> And the other
I have a multiselect drop-down field called holds. When nothing is selected, the holds
I have an ASP.NET MVC application with quite a few drop-down lists and multi-select
I have a multiselect dropdown inside a table <td> <select multiple=multiple name=multiple id=multiple class=required>
I have a listbox with multiselect options. I populate it using the addItem function.
I have the following multi-select box in a HTML form, where user can select

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.