报错信息:No suitable driver found for jdbc:mysql://localhost:3306/utf-8?useUnicode=true&characterEncoding=utf-8
我写的url:url="jdbc:mysql://localhost:3306/utf-8?useUnicode=true&characterEncoding=utf-8";
直接用main方法调用连接可以正常查询,但是从action中调用就会报错
这是采用main方法调用
public static void main(String[] args) {
UserBiz ubiz=new UserBizImpl();
String username="张三";
String password="123";
Users user=ubiz.getUser(username, password);
System.out.println(user);
}
这是在action中调用
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String username=request.getParameter("username");
System.out.println(username);
String password=request.getParameter("password");
System.out.println(password);
UserBiz ubiz=new UserBizImpl();
Users user=ubiz.getUser(username, password);