Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Select multiple entries from the same dropdown in JSP

843840Jul 5 2009 — edited Jul 6 2009
Hi everyone, my first time posting here.

My project here has both a jsp and a servlet. The JSP has dropdowns that are populated from a database. It lists all the certifications, qualifications and skills. I am trying to make it into a search engine. The servlet in turn would process what was selected and return a list of employees that meet all the criteria.

So far so good. I got one problem. I want it to be possible to select multiple certifications, or multiple qualifications or multiple skills. I'm not sure how to do this.

Here's the code from my jsp.
<%--
    Document   : Search credentials
    Created on : 20-Jun-2009, 6:33:52 PM
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page import="java.util.List" %>
<%@page import="Classes.*"%>
<%@page import="BusinessLayer.*"%>


<% Business business = new Business();%>
<% List certList = business.getCertifications();%>
<% List qualList = business.getQualifications();%>
<% List skillList = business.getSkill();%>
<% List searchList = business.getSearchResults();%>


<%-- make list accessible to page --%>

<% request.setAttribute("certifications", certList);%>
<% request.setAttribute("qualifications", qualList);%>
<% request.setAttribute("skills", skillList);%>
<% request.setAttribute("search1", searchList);%>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>Search Credentials and Availability</h1>
        
        <form ACTION="/ctsdb/SearchProcess" METHOD="POST">
            
            
            <h2>Certifications</h2><br>
            <select name="ddlcerts" >
                <c:forEach var="cert" items="" >
                    <option value="${cert.certificateName}">${cert.certificateName}</option>
                </c:forEach>
                <input type="Button" name="Add" onclick=" "/>
            </select><br><br>
        
            
            
            <h2>Qualifications</h2><br>
            <select name="ddlqual" >
                
                <c:forEach var="qual" items="${requestScope.qualifications}" >
                    <option value="${qual.qualificationName}">${qual.qualificationName}</option>
                </c:forEach>
                
                
            </select><br><br>
            
            
            <h2>Skills</h2><br>
            <select name="ddlskills" >
                
                <c:forEach var="skill" items="${requestScope.skills}" >
                    <option value="${skill.skillName}">${skill.skillName}</option>
                </c:forEach>
                
            </select><br><br>
           
        </form>
        
    </body>
</html>
The idea is to have a button next to each drop down that would store the currently selected item in the dropdown.
I was thinking of creating a bean with Arraylists, but I'm not sure how to extract the specific data that is currently highlighted in the dropdown. Any help would be awesome.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 3 2009
Added on Jul 5 2009
3 comments
648 views