I have had to take over the duties of our Java/JSP developer and my expertise is really in Php.

So, I have had to add a code to one of our Jsp pages, which the code simply all it does are:
1- get the users IP
2- see if their IP is blocked or not
3- if blocked then redirect them to page that says that they are blocked

However, the Jsp code is not working. Here is the code;

String user_ip = request.getRemoteAddr();
Connection cone_ip = getConnection();
PreparedStatement pse_ip = cone_ip.prepareStatement("SELECT COUNT(id) AS blocked_ip FROM people_news.blocked_ips WHERE '" + user_ip + "' BETWEEN start_ip AND end_ip";
ResultSet rse_ip = pse_ip.executeQuery();
if (rse_ip.getInt("blocked_ip") > 0){

Can you tell me what is wrong with this Jsp code?