上一篇 : 《Maven搭建struts2+spring+hibernate环境(二)》
后台功能都已完成,现在是前台的页面编写
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="userAction" method="post">
<table width="207" border="0" align="center">
<tr>
<td colspan="2" align="center" nowrap="nowrap">用户注册</td>
</tr>
<tr>
<td width="68" nowrap="nowrap">用户名</td>
<td width="127" nowrap="nowrap"><label>
<input name="user.username" type="text" id="username" size="20" />
</label></td>
</tr>
<tr>
<td nowrap="nowrap">密 码</td>
<td nowrap="nowrap"><input name="user.password" type="password" id="password" size="20" maxlength="10" /></td>
</tr>
<tr>
<td colspan="2" align="center" nowrap="nowrap"><label>
<input type="submit" value="注册" />
<input type="reset" value="重填" />
</label></td>
</tr>
</table>
</form>
</body>
</html>
success.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>Insert title here</title>
</head>
<body>
${user.username }
<br>
${msg }
</body>
</html>
error.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>Insert title here</title>
</head>
<body>
出错了。。。。。。。。。。
</body>
</html>
至此,项目编写基本完成。
右键项目---run as---maven install
编译成功,没有错误
现在可以部署到服务器上运行了,部署,启动,浏览器输入http://localhost:8080/MSSH/或者http://localhost:8080/MSSH/index.jsp回车
注册,查看数据库,成功!
至此,Maven搭建struts2+spring+hibernate开发环境就完成了,其中还有很多不足之处,希望大家指出。