list
===============================================================================================
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%><!-- 没有struts时只能用jsp标签 -->
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link href="<%=request.getContextPath()%>/statics/css/main.css" rel="stylesheet" style="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
<!-- 反应后台session保存的内容 -->
当前用户:${loginUser.userName }<br/>
<!-- 循环迭代 -->
<c:forEach items="${key}" var="myu">
<!-- 普通方式“?”传参 -->
<%-- ${myu.userName} ${myu.password} <a href="#">change</a> <a href="del?userName = ${myu.userName}">delete</a><br/> --%>
<!-- rest风格传参 -->
${myu.userName} ${myu.password} <a href="one/${myu.userName}">change</a> <a href="del/${myu.userName}">delete</a><br/>
</c:forEach>
</body>
</html>
================================================================================================
add
====================================================================================
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="sf"%>
<!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>
<!-- 方法1 -->
<!-- 使用普通的表单控件和servlet取值 -->
<!-- <form action="add" method="post">
用户名:<input type="text" name="userName"><br/>
密码:<input type="password" name="password"><br/>
<input type="submit" value="submit"/><br/>
</form> -->
<!-- zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz -->
<!-- 方法2 -->
<!-- 使用spring自带的表单控件 -->
<!-- 前台控件数据要想和实体类属性自动绑定的话
1:要用spring自己的标签
2:控件名字要和实体类属性的名字一致
3:modelAttribute的内容要和后台controller方法参数的名字一致 -->
<!-- 设置enctype表单才知道要传文件了。 -->
<sf:form action="add" modelAttribute="user" method="post" enctype="multipart/form-data">
<!-- path相当于控件的名字 -->
name:<sf:input path="userName"/><br/>
password:<sf:password path="password"/><br/>
<!-- 单文件上传 -->
<!-- 按钮用普通控件的标签,可以混合在一起用。 -->
<!-- attach:<input type="file" name="attach"/><br/> -->
<!-- 多文件上传 -->
attach:<input type="file" name="attachs"/><br/>
<input type="file" name="attachs"/><br/>
<input type="file" name="attachs"/><br/>
<input type="submit" value="submit"/>
</sf:form>
</body>
</html>
=====================================================================================
error
=====================================================================================
<%@ 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>
<!-- 局部异常的时候 -->
<%-- ${e.message} --%>
<!-- 全局异常的时候 -->
${exception.message}
</body>
</html>