模糊查询,查中文和英文报错,但是可以查数字服务类public ArrayList queryXm(String Fname){\x05\x05 \x05\x05\x05\x05 \x05\x05Fname = "%"+Fname+"%";\x05\x05 \x05\x05ArrayList al = null\x05\x05 \x05\x05try {\x05\x05 \x05 String sql = "s

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/21 22:22:10
模糊查询,查中文和英文报错,但是可以查数字服务类publicArrayListqueryXm(StringFname){\x05\x05\x05\x05\x05\x05\x05\x05Fname="%

模糊查询,查中文和英文报错,但是可以查数字服务类public ArrayList queryXm(String Fname){\x05\x05 \x05\x05\x05\x05 \x05\x05Fname = "%"+Fname+"%";\x05\x05 \x05\x05ArrayList al = null\x05\x05 \x05\x05try {\x05\x05 \x05 String sql = "s
模糊查询,查中文和英文报错,但是可以查数字
服务类
public ArrayList queryXm(String Fname){
\x05\x05 \x05\x05
\x05\x05 \x05\x05Fname = "%"+Fname+"%";
\x05\x05 \x05\x05ArrayList al = null
\x05\x05 \x05\x05try {
\x05\x05 \x05 String sql = "select * from oldcustomer where Fname like "
\x05\x05 \x05 al = (ArrayList)jt.query(sql,new OldRowMapper(),Fname);
\x05\x05 \x05 } catch (DataAccessException e) {
\x05\x05 \x05 e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
\x05\x05 \x05 }
\x05\x05 \x05\x05return al;
\x05\x05 \x05}
报错
type Exception report
message java.lang.NullPointerException
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException:java.lang.NullPointerException\x05org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:502)\x05org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:430)\x05org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)\x05org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)\x05javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
root cause

模糊查询,查中文和英文报错,但是可以查数字服务类public ArrayList queryXm(String Fname){\x05\x05 \x05\x05\x05\x05 \x05\x05Fname = "%"+Fname+"%";\x05\x05 \x05\x05ArrayList al = null\x05\x05 \x05\x05try {\x05\x05 \x05 String sql = "s
模糊查询需要单引号.Fname = "'%"+Fname+"%'";