public String deleteTest(){
testBiz.delTest(shopPoster.getId());
String savePath = ServletActionContext.getServletContext().getRealPath(
""); // 获取项目根路径
savePath = savePath + "/upload/";
File file=new File(savePath+shopPoster.getContext());
file.delete();
resultMap="testActionshow.action";
return SUCCESS;
}
jsp上的 <script type="text/javascript">
function del(id){
location.href="shopEcsVoteOptiondeletePoster.action?shopPoster.id="+id
}
function ret(){
location.href="addPoster.jsp";
}
</script>
<body ><!--
<form action="shopEcsVoteOptiondeletePosters.action" method="post" name="myForm">
--><table align="center" border="1">
<s:iterator value="#request['listShopPoster']" var="listShopPoster">
<tr>
<td>
<img src="Poster/<s:property value="#listShopPoster.context"/>" height="50" width="50" />
</td>
<td>
<input type="button" value="删除" onclick="del(<s:property value="#listShopPoster.id"/>)">
</td>
</tr>
</s:iterator>
<tr>
<td>
<input type="button" value="继续添加" onclick="ret()">
</td>
</tr>
</table><!--
</form>
--></body>