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

jsp 传值 post得不到值,get可以,为什么
小弟写了个登陆界面,页面提交给servlet,提交方法用post得不到值,用get却可以。可是不能用get啊,不然密码地址栏里都出来了
登陆jsp如下:
HTML code

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<html>
    <head>
        <title>网站信息管理系统</title>
        <link href="home/home.css" rel="stylesheet" type="text/css" />
    </head>

    <body>
        <Script>if(self!=top){top.location=self.location;}</script>
        
        <script language="javascript">
            function checklogin() {
                if (document.login.name.value == '') {
                    alert('请输入帐户');
                    document.login.username.focus();
                    return false
                }
                 if (document.login.password.value == '') {
                    alert('请输入密码');
                    document.login.password.focus();
                    return false
                }
                if (document.login.yzm.value == '') {
                    alert('请输入验证码');
                    document.login.yzm.focus();
                    return false
                }
            }
        </script>
        <div class="b_w">
            <div class="l_t">
                <div class="left l_title">
                    网站管理系统
                </div>
                <div class="right">
                    <a href="../"> <img src="home/icon_back.gif" alt="返回" hspace="4" vspace="8" border="0" /> </a>
                    <a href="javascript:window.close()"><img src="home/icon_close.gif" alt="关闭" hspace="4" vspace="8" border="0" />
                     </a>
                </div>
            </div>
            <div class="l_bg">
                    <form action="/SixMen/Employee" name="login" method="post"
                        onSubmit="return checklogin();">
                        <ul class="l_user">
                        <li>
                            帐户:
                            <input name="name" size="14" type="text" class="l_input" />
                        </li>
                        <li>
                            密码:
                            <input name="password" size="14" type="password" class="l_input" />
                        </li>
                        <li>
                            验证:
                            <input name="yzm" id="yzm" size="3" type="text" class="l_input" />
                            <img id=img src="home/img.jsp" alt="图片看不清?点击刷新"
                                onclick="img.src='home/img.jsp?'+new Date().getTime()";>
                        </li>
                        <li>
                            <input class="l_bnt" value="登 录" type="submit" />
                            <input class="l_bnt" value="重 写" type="reset" />
                        </li>
                </ul>
                    </form>
            </div>
            <div class="l_f">
                <div class="left">
                    <img src="home/f_l.gif" />
                </div>
                <div class="left">
                    <img src="home/f_bg.gif" width="378" height="36" />
                </div>
                <div class="right">
                    <img src="home/f_r.gif" />
                </div>
            </div>
        </div>
    </body>
</html>