2
<select name="qualification">
   <%
     Connection con=null;
     Statement st=null;
     ResultSet res;
     try{
       Class.forName("oracle.jdbc.driver.OracleDriver");
       con=DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:XE","system","123");
       st=con.createStatement();
       res=st.executeQuery("select qualification from course");
       while(res.next()){
         String qualification = res.getString("qualification");
  %>
      <option value="<%=qualification%>"><%=qualification%></option>
  <%
      }
    }catch(Exception e)
    {    out.print(e);
    }
 %>

</select>

Here I am trying to display values in the combox box, but the combobox shows empty in the output! My db table has just two fields, name and qualification with enough values.

Cœur
  • 37,241
  • 25
  • 195
  • 267
TrueDroider
  • 59
  • 1
  • 13

1 Answers1

0

Your code

 }catch(Exception e)
{    out.print(e);
}

Outputs the error into your html where it's hard to find. Consider logging full stacktrace into server-log as well

 }catch(Exception e) {    
   e.printStackTrace ();
   out.print(e);
 }

As you mentioned in comment you see a class not found for the oracle driver - make sure to add ojdbc6.jar (or ojdbc7.jar) into your WEB-INF/lib or into your tomcat/lib folder (or similar depending on your servlet engine)

Jan
  • 13,738
  • 3
  • 30
  • 55