有关jsp中连接数据库查询用户密码是否正确的问题
<%
String userName1=request.getParameter("UserName");
String password=request.getParameter("UserPassword");
String frm_shenfen=request.getParameter("shenfen");
String sql;
ResultSet rs;
if(frm_shenfen.equals("users")){
sql="select password from t_user where userName='"+userName1+"'";
rs=db.executeQuery("sql");
String password1=rs.getString("password");
out.println("password1");
}
%>
提示错误:
org.apache.jasper.JasperException: An exception occurred processing JSP page /admin-templates/login1.jsp at line 21 就是String password1=rs.getString("password")这行
eclipse控制台报错:
com.microsoft.sqlserver.jdbc.SQLServerException: 找不到存储过程 'sql'。
十二月 02, 2013 4:38:55 下午 org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at org.apache.jsp.admin_002dtemplates.login1_jsp._jspService(login1_jsp.java:82)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:879)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:617)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1760)
at java.lang.Thread.run(Thread.java:724)