这里我曾经试过用html,但是好像跳转过去吃不到EL表达式。。。
step5:
这里就是表现层的东西了,我JSP也学得马马虎虎。。
我这里贴一下我的webapp目录
webapp目录
index.jsp
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>首页</title>
</head>
<body>
<form action="${pageContext.request.contextPath }/login" method="post">
姓名:<input type="text" name="uesrname" id="uesrname" value=""/>
密码:<input type="text" name="password" id="password" value=""/>
<input type="submit" name="submit" value="登录"/>
</form>
<br/>
<form action="${pageContext.request.contextPath }/register" method="post">
姓名:<input type="text" name="uesrname" id="uesrname" value=""/>
密码:<input type="text" name="password" id="password" value=""/>
<input type="submit" name="submit" value="注册"/>
</form>
${message }
</body>
</html>
这个文件中,和登录流程相关的就是/login了
welcome.jsp
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>首页</title>
</head>
<body>
登陆成功<br/>
${message }${sessionScope.username }
</body>
</html>
这里两个前台文件就写完了
如果我的内容在哪里有问题,欢迎私信指正。