日期:2014-05-17 浏览次数:20747 次
<package name="person" namespace="/" extends="struts-default"> <action name="TbPerson" class="com.index.PersonAction" method="update"> <result name="success">/index.jsp</result> </action> <action name="hibernate1" class="com.index.PersonAction" method="save"> <result name="success">/index.jsp</result> </action>
<body> <h1>留言板</h1> <s:form action="TbPerson.action" /> <s:a href="taglibtest.jsp">写留言</s:a> <hr/> <s:a href="management.jsp">留言板管理</s:a> <hr/> <h1>留言:</h1> <s:iterator value="#request.list" id="TbPerson"> <s:div> <s:label value="姓名:"/> <s:property value="name"/> </s:div> <s:div> <s:label value="内容:"/> <s:property value="msg"/> </s:div> <s:div> <s:a href="deleteps.action?id=%{#TbPerson.id}" >删除</s:a> </s:div> <hr/> </s:iterator>
public String update()throws Exception{ TbPerson person = new TbPerson(); person.setName(name); person.setMsg(msg); DBperson.update(person); List<TbPerson> list=DBperson.ListAll(); HttpServletRequest request =ServletActionContext.getRequest(); request.setAttribute("list", list); //保存数据 return SUCCESS; }