jsp网页表单的一点小问题,帮帮忙!
jsp表单的提交与显示,我弄的提交后有错误,各位看看!longin.jsp
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>My Frist JSP Web</title>
<style type="text/css">
<
h1 {font: 15pt/17pt "Arial"; font-weight: bold; color:maroon}
body {
background-color:#FFFBF0
}
.STYLE1 {font-size: x-large}
>
</style>
</head>
<body>
<H1 align="center" class="STYLE1" >欢迎各位光临!</H1>
<form action="logins.jsp" method="post" name="form1">
<p><center>
登陆姓名:
<input name="name" type="text" /></center>
</p>
<p><center>
登陆密码:
<input name="password" type="password" /></center></p>
<p><center>
<input name="ok" type="submit" value="确认" />
<input name="back" type="submit" value="重置" />
</center>
</p>
</form>
</body>
</html>
logins.jsp
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body><pre>
<%
String na=request.getParameter("name");
String pa=request.getParameter("password");
if(name==null||password==null)out.println("很抱歉,你没有输入正确!");
else
{
out.println("你的姓名:");
out.println(na);
out.println("您的密码:");
out.println(pa);
}
%>
</body>
</html>
------解决方案--------------------
String na=request.getParameter("name");
String pa=request.getParameter("password");
if(name==null||password==null)out.println("很抱歉,你没有输入正确!");
改成
Java code
if(na==null||pa==null)