第一个:
   是不是空指针错误呀?你把  ” username.equals(str)“ 改为:“str.equals(username)" 看看。

解决方案 »

  1.   

    1、String str=new String("username");
    str中得内容为username
    可能你得username变量中得内容不是username吧。
    2、String str=new String("password");
    String str1=new String("passwordconfirm");
    str中得内容为password
    str1中得内容为passwordconfirm
    肯定不一样了。注意拷贝构造对象应该是String str=new String(username);,不要在源对象上加“
      

  2.   

    String str=new String("password");
    String str1=new String("passwordconfirm");String str=new String("username");都写死了怎能判断正确???
      

  3.   

    用System.out.println();把str 和 str1 的值分别打出来,看看为什么不一样,你就应该可以想出是为什么了
      

  4.   

    String str=new String("password");
    String str1=new String("passwordconfirm");
    str.equals(str1)的值肯定是false的嘛]!!!
    不用打都知道的啊
      

  5.   

    楼主把错误贴出来!
    还有就是!String str=new String("username");这样写不是个好习惯,回消耗更多的内存!
    一般这样写String str="username";
    String username=request.getParameter("username");//输入的是不是为空了?是不是有空格?