现在的框架比较流行,为了更好的理解框架,javaweb的基本开发形式还需要了解。
下面是运用jsp+servlet技术是实现登录。(没有运用数据库,数据操作比较简单,这个例子主要描述开发流程)
project:jspServletLoginTest
项目的目录结构如下:
下面贴上代码:
index.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- 该Login页面是一个简单的登录界面 -->
<html >
<head>
<title>Login</title>
<meta http-equiv= "content-type" content = "text/html; charset=UTF-8">
<meta http-equiv= "Content-Language" content = "ch-cn">
</head>
<body >
<!-- Form 用来提取用户填入并提交的信息-->
<form method = "post" name = "frmLogin" action="loginServlet">
<h1 align = "center"> USER LOGIN</h1> <br >
<div align = "center" > User name:
<input type = "text" name = "txtUserName" value = "hym"
size = "20" maxlength = "20" > <br> Password:
<input type = "password" name = "txtPassword" value = "Your password"
size = "20" maxlengt