面:people.jsp,代码如下:
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!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>People列表页 </title>
</head>
<body>
<table>
<tr>
<td>id</td>
<td>name</td>
<td>delete</td>
</tr>
<s:iterator value="peoples" var="peo">
<tr>
<td><s:property value="people.id"/> </td>
<td>${peo.name}</td>
<td><a href="people!delete.action?id=${peo.id}">删除 </a></td>
</tr>
</s:iterator>
</table>
< ;/body>
</html>
另一个添加人员的页面:people-input.jsp,代码如下:
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<! 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>People添加页 </title>
</head>
<body>
<form action="people!save.action" method="post">
名字:<input type="text" name="people.name"/> <br/>
<input type="submit" value="添 加"/>
</form>
</body>
</html>
运行一下看看效果吧!
随文源码
|