JavaServer Pages (JSP) and JSTL - jsp is throwin "java.lang.NullPointerException" while using Re
hi..
please help .
i have one jsp page "processRegistration.jsp". which was called thru another jsp...below is the code
<%@ page language="java" %>
<%@ page import="DataAccessObject.Connect" %>
<%@ page import="java.sql.*"%>
<%@ page import="javax.sql.*" %>
<html>
<body>
<%
String str_rid = (String)request.getParameter("ru");
int user_rid=Integer.parseInt(str_rid);
Connect.connectDb();
String str ="select * from Registration where rid=user_rid";
ResultSet rs=Connect.processQuery(str);
String fname;
if(rs.next())
{
fname=rs.getString(2);
out.println(fname);
}
Connect.closeConnection();
}
%>
</body>
</html>
when i run i get exception "The server encountered an internal error() that prevented it from fulfilling this request"
root cause : java.lang.NullPointerException. pls tell how to get rid of this error.
In above code 'Connect' is the class which i am using for connection purpose. It is working fine as i hav used it with other jsp pages with no probs.connectDb() & processQuery() r method of 'Connect' class.
i hav tried to debug the code, it is clear that str_rid and user_id are able to store the required value...
error comes only after
ResultSet rs = Connect.processQuery(str);
.
note : i hav checked the value of user_rid, while debugging & it does match with one of the row of the 'registration' table. 'fname' is the 2nd field of the table.
So i dont understand why it is throwing 'NullPointerException' even when all variables r declared & initialized..
Please help soon..

