;/th>
<th scope="col">发表时间</th>
<th scope="col">管理</th>
</tr>
<s:iterator value="articles">
<tr>
<td>${id}</td>
<td>${title}</td>
<td>${author}</td>
<td><s:date name="pubtime" format="yyyy/MM/dd"/></td>
<td><a href="article!input.action?article.id=${id}">编辑</a>|<a href="article!delete.action?article.id=${id}">删除</a></td>
</tr>
</s:iterator>
</table>
</body>
</html>
Struts 2.1.6精简实例系列教程(4):新闻管理模块的实现(3)
时间:2011-01-20 BlogJava 心梦帆影
新闻编辑页的代码如下:
<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>SimpleWeb新闻列表页</title>
</head>
<body>
<h5><a href="article.action">新闻列表<a/>——<a href="article!input.action">发表新闻<a/></h5>
<h2>编辑新闻</h2>
<form action="article!save.action" method="post">
<input type="hidden" name="article.id" value="${article.id}"/>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<th scope="row">新闻标题</th>
<td><input type="text" name="article.title" value="${article.title}"/> </td>
</tr>
<tr>
<th scope="row">提交者</th>
<td><input type="text" name="article.author" value="${article.author}"/> </td>
</tr>
<tr>
<th scope="row">新闻内容</th>
<td><textarea rows="20" cols="70" name="article.content">${article.content}</textarea> </td>
</tr>
<tr>
<th scope="row"> </th>
<td><input type="submit" value="保存"/></td>
</tr>
</table>
</form>
</body>
</html>
输入http://localhost:8060/SimpleWeb/admin/article.act |