i am tring to avoid java code in jsp file. But i couldnt figure the solution. Can anyone help me?
JSP file :
<select>
<%
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
String url="jdbc:oracle:thin:@localhost:1521:xe";
String username="sys as sysdba";
String password="sys";
String query="select lecturerFullname from lecturer";
Connection con=DriverManager.getConnection(url,username,password);
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery(query);
while(rs.next())
{
%>
<option><%=rs.getString("lecturerFullname") %></option>
<%
}
%></select>
</table>
<%
rs.close();
stmt.close();
con.close();
}
catch(Exception e)
{
e.printStackTrace();
}
%></select>
This is what i tried... getAttribute() returns null for drop down list in jsp but i still couldnt find the solution. Do i have to use JSTL? can i avoid using JSTL hehe... I REALLY REALLY HOPE SOMEONE TO HELP ME. THANK YOU!!!!