
<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<html>
<head>
<title>Untitled Document</title>
</head>
<%
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/mhs?user=root&password=admin");
Statement stmt=conn.createStatement();
ResultSet rs=null;
%>
<body>
<form method="post">
Select Your Choice:
<select name="Lab">
<option value="No"><--Select Lab/Non-Lab--></option>
<option value="Lab">Lab Base Students</option>
<option value="Non-Lab">Non-Lab Base Students</option>
</select>
<br></br>
<input type="submit" value=" To Show Student List Click here"><br></br>
</form>
<% String Lab=request.getParameter("Lab");
String query=null;
if (Lab == "Lab"){
query="SELECT REGNO,SNAME FROM sub_comb WHERE L_category='Lab'";
}
else if (Lab == "Non-Lab")
{
query="SELECT REGNO,SNAME FROM sub_comb WHERE L_category='Non-Lab'";
}
rs=stmt.executeQuery(query);
%>
</body>
</html>
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.