Hello every one..plzz solve my problem here iam specifying where condition in my jsp page but it doesnt work.. with out specifying where condition it displays all data in my table.. iam getting the problem with the where condition in the jsp with MYSQL and code is.. Class.forName ("com.mysql.jdbc.Driver").newInstance (); Code: Connection con = DriverManager.getConnection(url, user, pass); Statement stmt=con.createStatement(); String section=request.getParameter("section"); String QueryString = "SELECT * from students where section='"+section+"'"; rs = stmt.executeQuery(QueryString); %> <TABLE cellpadding="5" border="1" style="background-color: #ffffcc;" align="center"> <% while (rs.next()) { %> <TR> <TD>Regd No</TD> <TD>Name</TD> <TD>BRANCH</TD> </TR> <TR> <TD><%= rs.getString(1) %></TD> <TD><%= rs.getString(2) %></TD> <TD><%= rs.getString(3) %></TD> </TR> <% } %> <% // close all the connections. rs.close(); stmt.close(); con.close(); } plzzz.....thanks in advance...
You can solve this problem with the where condition in the jsp by putting spaces before and after the 'section' as given below String QueryString = "SELECT * from students where section='"+ section +"'";