日期:2014-05-20  浏览次数:20808 次

大家帮我看一下哪里有错
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

doPost(request, response);
}


public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

String UserName = request.getParameter("username");
String UserPass = request.getParameter("userpass");

if(UserName =="123" && UserPass=="123"){
response.sendRedirect("MyJsp.jsp");
}else {
JOptionPane.showConfirmDialog(null, "请检查输入的内容是否出错");
}
}

我这样写了之后 UserName 和 UserPass 都对的情况下还会弹出提示框
各位帮我看下应该怎么改成 在用户名和密码正确的情况下跳到相应的页面。输入错误才弹出提示框

------解决方案--------------------
if(UserName .equals("123") && UserPass.equals("123")){