美文网首页
jsp 一个表单两个提交按钮处理

jsp 一个表单两个提交按钮处理

作者: huangxiongbiao | 来源:发表于2017-06-27 17:22 被阅读23次
    <%@ page language="java" contentType="text/html; charset=GB2312"
        pageEncoding="GB2312"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=GB2312">
    <title>Insert title here</title>
    <Script Language="JavaScript"> 
        function register() 
        { 
            /* alert("register"); */
            /* window.location.href = "${pageContext.request.contextPath}/User/register"; */
           document.forms[0].action="${pageContext.request.contextPath}/User/register"; 
           document.forms[0].submit();  
        } 
         
        function login() 
        { 
             /* alert("${pageContext.request.contextPath}/User/login"); */ 
            /* window.location.href = "${pageContext.request.contextPath}/User/login";  */
            document.forms[0].action="${pageContext.request.contextPath}/User/login"; 
            document.forms[0].submit(); 
        } 
    </Script>
    </head>
    <body>
    <body>
        <p>${message}</p>
        <form method="post">
            <fieldset>
            <legend>用户登录</legend>
                <p>
                    <label>姓名:</label> <input type="text" id="name" name="name"
                        tabindex="1">
                </p>
                <p>
                    <label>密码:</label> <input type="text" id="password" name="password"
                        tabindex="2">
                </p>
                <p id="buttons">
                    
                    <!-- <input id="register"  name="action" type="submit" tabindex="3" value="注册">
                    <input id="submit" name="action" type="submit" tabindex="4" value="登录"> -->
                    <input Type="Button" name="Modify" value="注册" onClick="register()"> 
                    <input Type="Button" name="Delete" value="登录" onClick="login()"> 
                </p>
            </fieldset>
        </form>
    </body>
    </body>
    </html>
    

    相关文章

      网友评论

          本文标题:jsp 一个表单两个提交按钮处理

          本文链接:https://www.haomeiwen.com/subject/jnvecxtx.html