html页面代码
<form id="form1" action="login_login.action" method="post"  >
            username
            <input type="text" name="username">
            </br>
            password
            <input type="password" name="password">
            <input id="login" type="submit">
            <button id="btn" type="button">
                注册
            </button>
        </form>
js代码
$(document).ready(function() {
    $("#btn").click(function() {
        $("#form1").attr("action", "register_register.action");
        $("#form1").submit();
    })
    var hid1value = $("#hid1").val();
    if (hid1value == "1") {
        alert("您的用户名/密码错误");
    }
})
java文件代码
 public String  login() {
        System.out.println("传递进来的用户名是"+username+"  传递进来的密码是"+password);
        if (username.equals("AAA") && password.equals("123")) {
            setLoginerror("0");
            setSuccessPath("success.jsp");              
            return "success";
        } else {
            setLoginerror("1");
            setSuccessPath("test.html");                
            return "success";
        }        
    } 
问题是 没有alert 错误用户名可以转向test.html
解决问题:
发现
1.用js没有引用jquery
2.html不能直接使用 ${}取值