【发布时间】:2014-10-02 16:19:43
【问题描述】:
我想在 JSP 本身中验证 JSP,但它给了我一个空指针异常......我的代码如下......
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Login Form</title>
<link rel="stylesheet" href="admincss/style.css">
<!--[if lt IE 9]><script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
</head>
<body>
<%
String username=request.getParameter("txt_username");
String password=request.getParameter("txt_password");
if(username.equals("k") && password.equals("k"))
{
response.sendRedirect("Admin");
}
%>
<section class="container">
<div class="login">
<h1>Login to Web App</h1>
<form method="post" action="admin.jsp">
<p><input type="text" name="txt_username" value="" placeholder="Username or Email"></p>
<p><input type="password" name="txt_password" value="" placeholder="Password"></p>
<p class="remember_me">
<label>
<input type="checkbox" name="remember_me" id="remember_me">
Remember me on this computer
</label>
</p>
<p class="submit"><input type="submit" name="btn_commit" value="Login"></p>
</form>
</div>
<div class="login-help">
<p>Forgot your password? <a href="index.html">Click here to reset it</a>.</p>
</div>
</section>
<section class="about">
<p class="about-links">
<a href="http://www.cssflow.com/snippets/login-form" target="_parent">View Article</a>
<a href="http://www.cssflow.com/snippets/login-form.zip" target="_parent">Download</a>
</p>
<p class="about-author">
© 2012–2013 <a href="http://thibaut.me" target="_blank">Thibaut Courouble</a> -
<a href="http://www.cssflow.com/mit-license" target="_blank">MIT License</a><br>
Original PSD by <a href="http://www.premiumpixels.com/freebies/clean-simple-login-form-psd/" target="_blank">Orman Clark</a>
</section>
</body>
</html>
我不明白这个错误.....如果这不是正确的方法,请给我推荐正确的方法
【问题讨论】: