u或者p是null, 反过来写:
"yxl".equals(u) && "123".equals(p)
记住,用equals判断String时,常量一般写在前面,这样可以防止NullPointer

解决方案 »

  1.   


    是要看报错界面吗报错代码如下HTTP Status 500 - --------------------------------------------------------------------------------type Exception reportmessage description The server encountered an internal error that prevented it from fulfilling this request.exception java.lang.NullPointerException
    com.yxl.LoginCl.doGet(LoginCl.java:26)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    note The full stack trace of the root cause is available in the Apache Tomcat/7.0.47 logs.
    --------------------------------------------------------------------------------Apache Tomcat/7.0.47
      

  2.   


    谢谢这个有用 我按照你说的改了 可是它就无法跳转到欢迎界面了 老是跳转到登录界面
    我有三个java文件 一个是登录的 这个可以编译 还有一个是登录验证的 最后就是欢迎界面了