jsp页面样例及解析


<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<% String path =request.getContextPath();%>
<%@ taglib prefix="display" uri="http://displaytag.sf.net/el" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><El标签核心库>
<!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>

<link href="css/displaytag.css" rel="stylesheet">
<script type="text/javascript" src="jquery-1.10.2.min.js">
</script>
<script type="text/javascript">
$(function(){
	$(".delete").click(function(){
	 var href = $(this).attr("href")
	 $("form").attr("action",href).submit()
	 return false;
	});
	
})
</script>
</head>
<body>
	
	<form action="" method="post">
		<input type="hidden" name="_method" value="DELETE">
	</form>
	
<display:table name="users" cellspacing="0" style="list" pagesize="3"   cellpadding="0" defaultsort="1">
<display:column property="id" title="ID" class="idcol" />
<display:column property="name" url="/user"  paramId="id" paramProperty="id"/>
<display:column property="password" autolink="true"/>
<display:column property="birthday" title="Comments"/>
</display:table>
	
	
	
	<table border="1">
	<c:if test="${empty requestScope.users }">没有任何员工信息</c:if>
	<c:if test="${!empty requestScope.users }">
	<c:forEach items="${users}" var="u">
		<tr>
		<td>${u.id}</td>
		<td>${u.name}</td>
		<td>${u.password}</td>
		<td>${u.birthday}</td>
		<td><a href="user/${u.id }">编辑</a></td>
		<td><a class="delete" href="user/${u.id }">删除</a></td>
		</tr>
	</c:forEach>
	</c:if>
	</table>
	
	
	
</body>
</html>
posted @ 2016-05-24 12:30  goumingming  阅读(309)  评论(0编辑  收藏  举报