簡體   English   中英

JSP登錄getParameter返回null

[英]JSP Login getParameter return null

我讓簡單的登錄頁面使用jsp

我的問題是getParameter始終為null

這是我的mainpage.jsp代碼

<form action = "LoginProcess.jsp" method = "post">  
    <table align="center">
    <tr>
    <td><label for="userid">ID : </label></td>
    <td><input type="text" name="userid" id="userid"></td>
    </tr>
    <tr>
    <td><label for="userpw">PW : </label></td>
    <td><input type="password" name="userpw" id="userpw"></td>
    </tr>
    <tr>
    <td colspan="2" align="center">
    <input type="hidden" name="status">
    <input type="button" name="join" class="loingbtn" value="">
    <input type="button" name="find" class="loingbtn" value="">
    <input type="button" name="booking" class="loingbtn" value="">
    <input type="button" name="msg" class="loingbtn" value="">
    <input type="submit" name="login" class="loginbtn" value="">
</form>

這是loginprocess.jsp

<body>
    <jsp:useBean id = "brd" class = "mainpage.LoginUser" scope="page"/>
    <jsp:useBean id = "brddb" class = "mainpage.UserDB" scope="page"/>
    <%          
        String id = request.getParameter("userid");
        String passwd = request.getParameter("userpw");
        if ((brddb.isLogin(id, passwd))) {  
    %>
    <script>
        alert("Success");
    </script>
    <%
        }else{
            %>
            <script>
            alert("Fail");
            self.close();
            </script>
            <%
        }
%>

這兩個變量始終為null

String id = request.getParameter("userid");
String passwd = request.getParameter("userpw");

我能做什么

檢查是否在這兩個類中

    <jsp:useBean id = "brd" class = "mainpage.LoginUser" scope="page"/>
    <jsp:useBean id = "brddb" class = "mainpage.UserDB" scope="page"/>

您將id和psswd設置為null。

那可能是您變得空的唯一原因。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM