struts2里面的删除问题
原本我是想做一个界面实现删除的功能,这里说的删除不是真正的删除而是,修改一个状态,让他以后不能再次被查询到,当然都是默认好的查询,但是当我应用底层修改的时候,状态的值不变,并且数据表里面该字段也没有被删除,所以想请教各位,这个应该怎么弄
Action字段
public String delTem(){
String ttelephone=temporary.getTtelephone();
TemporaryDao td=new TemporaryDao();
System.out.println("-------------Action telephone="+ttelephone);
td.delTem(ttelephone);
return "selTem_2";
}
javaDao字段
public int delTem(String ttelephone) {
conn = DBUtil.getConnection();
int res = 0;
String sql = "update temporary set tos='0' where ttelephone=?";
try {
ps = conn.prepareStatement(sql);
ps.setString(1, ttelephone);
res = ps.executeUpdate();
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
} finally {
DBUtil.closeAll(conn, ps, null);
}
return res;
}
jsp页面字段
<s:if test="list!=null && list.size()>0">
<input type="hidden" name="nowpage" value="1" />
<table width="1100" cellpadding="5" cellspacing="0" align="center"
border="1" bordercolor="white">
<tr>
<th width="60px;">
姓名
</th>
<th width="30px;">
性别
</th>
<th width="100px;">
电话
</th>
<th width="100px;">
身份证号
</th>
<th width="150px;">
每周空闲时间
</th>
<th width="190px;">
当前执行项目编号
</th>
<th width="190px;">
当前执行项目名称
</th>
<th>
删除
</th>
</tr>
<s:iterator var="l" value="list">
<tr>
<th>
<a href="TM/ShowSel.jsp" style="text-decoration: none"><font
color="black">${l.tname }</font> </a>
</th>
<th>
${l.tsex }
</th>
<th>
${l.ttelephone }
</th>
<th>
${l.tidcard }
</th>
<th>
${l.tftime }
</th>
<th>
${l.tncpid }
</th>
<th>
${l.tncpname }
</th>
<th>
<input type="button" value="删除" onclick="onDel();"/>
</th>
</tr>
</s:iterator>
</table>
<p align="center">
<s:if test="%{nowpage>1}">
<a href="javascript:f_page(<s:property value="nowpage"/> - 1)"
id="spage"> 上一页 </a>
</s:if>
<s:if test="%{nowpage<=1}"> 上一页 </s:if>
当前页:
<s:property value="nowpage" />
总页数:
<s:property value="allpage" />
<s:if test="%{nowpage>=allpage}">下一页</s:if>
<s:if test="%{nowpage<allpage}">
<a href="javascript:f_page(<s:property value="nowpage"/> + 1)">
下一页</a>
</s:if>
</p>
</s:if>
js字段
function onDel(ttelephone) {
document.forms[0].action = "TemporaryAction_delTem?temporary.ttelephone="
+ ttelephone;
document.forms[0].method = "post";
document.forms[0].submit();
}