Values based on another drop down

plz check d following code 😔
[sookie]

dropdown.jsp
<%@page contentType="text/html" pageEncoding="UTF-8"%>





Semester :


Department :








populateSubject.jsp


<%@page import="java.sql.*"%>
<%@page import="javax.sql.*"%>
<%
//open a database connection
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rs = null;
try{
// String url = "jdbc:sqlserver://[DB Server IP]:[DB Server Port];";
String url = "jdbc:derby://localhost:1527;";

//String driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
String driver = "org.apache.derby.jdbc.ClientDriver";

String userName = "[app]";
String password = "[root]";
String semVal=request.getParameter("semVal");
String deptVal=request.getParameter("deptVal");

Class.forName(driver).newInstance();
conn = DriverManager.getConnection(url,userName,password);

//String s="Select sub_code,sub_name from subject_details where semester ="+ semVal +" and department='"+ deptVal +"'";
String s="Select sub_code,sub_name from subject_details where semester ="+ semVal +" and department='"+ deptVal +"'";
stmt=conn.prepareStatement(s);
rs=stmt.executeQuery();

out.print("

Subjects : ");
out.print("");


}

catch(Exception e ){
out.print("

The following exception was thrown:
");
}
finally{
try{if(rs!=null)rs.close();}catch(SQLException e2){out.print(e2);}
try{if(stmt!=null)stmt.close();}catch(SQLException e2){out.print(e2);}
try{if(conn!=null)conn.close();}catch(SQLException e2){out.print(e2);}
}
%>

Replies

You are reading an archived discussion.

Related Posts

CrazyEngineers is proud to me online media partner for Startup Showcase Competition - 2015, IIT Delhi. Entrepreneurship Development Cell (eDC), IIT Delhi is presenting its flagship event Startup Showcase Competition...
https://www.topgear.com/uk/car-news/Naturally-aspirated-vs-forced-induction-2012-10-09
Singapore based Creative Technology Ltd. specializes in the design & manufacturing of digitized sound and video boards and other digital products. One of its most successful products is the Sound...
hello friends, iam doing final year computer science engg, i interested to do projects based client-server implementation on linux based systems, but my guide says only ieee paper based projects...
The latest HTC Smartphone in India brings a combination of good looks and interesting set of specs under one device. Called HTC Desire 816G, the new smartphone is an upgraded...