实在想不明白的错误 如果把userDao类中的userlogin方法改成小写就一直跳转到登录失败页面 如果改成userLogin就报错(dologin.jsp当然也改变了还是不行)
//Dao类用户业务逻辑
package com.dao;
import com.po.User;
//用户的业务逻辑类
public class UserDao {
//判断用户名密码是否是admin
public boolean userLogin(User u){
if("admin".equals(u.getUsernma()) && "admin".equals(u.getPassword())){
return true;
}else{
return false;
}
}
}
//dologin.jsp
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<jsp:useBean id="loginUser" class="com.po.User" scope="page" />
<jsp:useBean id="userDao" class="com.dao.UserDao" scope="page" />
<jsp:setProperty property="*" name="loginUser"/>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
request.setCharacterEncoding("utf-8");
if(userDao.userLogin(loginUser)){
session.setAttribute("loginname",loginUser.getUsernma());
request.getRequestDispatcher("login_success.jsp").forward(request, response);//如果正确服务器内部转发
}else{
response.sendRedirect("login_cuo.jsp");
}
%>
如果改成大写的就是空指针异常 小写的就一直跳转到登录错误这个页面 跪求大神帮忙
The server encountered an internal error that prevented it from fulfilling this request.