I'm make simple login page use jsp
my problem is getParameter is always null
this is my mainpage.jsp code
<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>
This is 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>
<%
}
%>
this two variable is alaway null
String id = request.getParameter("userid");
String passwd = request.getParameter("userpw");
what can i do
Check whether in these 2 classes
<jsp:useBean id = "brd" class = "mainpage.LoginUser" scope="page"/>
<jsp:useBean id = "brddb" class = "mainpage.UserDB" scope="page"/>
you are setting id and psswd to null.
That could be the only reason you are getting null.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.