JSP - Beginner question , Bypass the if..statement on page load?
Posted
by TatMing
on Stack Overflow
See other posts from Stack Overflow
or by TatMing
Published on 2010-03-15T16:25:06Z
Indexed on
2010/03/15
16:29 UTC
Read the original article
Hit count: 223
jsp
i am new in JSP,i have some problem with the following code :
<%@ page contentType="text/html;charset=Big5" %>
<html>
<head>
<title></title>
</head>
<body>
<form method="post" action="InsertStudent.jsp">
<input type="text" size="20" name="txtName" />
<input type="text" size="20" name="txtDob" />
<input type="text" size="20" name="txtProStudied" />
<input type="submit" name="B1" value="Submit" />
</form>
<%
if (request.getParameter("txtName") !="" && request.getParameter("txtDob") != "" && request.getParameter("txtProStudied") != "" ) {
out.println("...bypass the if....statement");
}
%>
</body>
</html>
If run this code, the out.println will fire even the 3 input box have value or not..
© Stack Overflow or respective owner