日期:2014-05-17 浏览次数:20763 次
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dwr PUBLIC
"-//GetAhead Limited//DTD Direct Web Remoting 1.0//EN"
"http://www.getahead.ltd.uk/dwr/dwr30.dtd">
<dwr>
<allow>
<create javascript="maildao" creator="new">
<param name="class" value="com.dbs.mail.dao.impl.MailDaoImpl"></param>
</create>
</allow>
</dwr>
<display-name>DWR (Direct Web Remoting)</display-name>
<description>A Simple Demo DWR</description>
<servlet>
<servlet-name>dwr-invoker</servlet-name>
<servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>dwr-invoker</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
public boolean deleteMessage(int id) {
try {
session.beginTransaction();
Mail m=(Mail) session.get(Mail.class, id);
System.out.println("++++++++++++++++++++deleteMessage+++++++++++++++++++++++");
m.setDelState(1);
session.getTransaction().commit();
return true;
} catch (HibernateException e) {
e.printStackTrace();
return false;
}finally{
if(session!=null){
session.close();
}
}
}
<script type="text/javascript">
function deleteMail(id,a){
/* alert(id); */ //在这里id是可以取到的
alset(a);
maildao.deleteMessage(id,function(result){
alert("ssssssssssssssssss");
if(result){
alert("删除成功");
var tr=a.parentNode.parentNode;
tr.parentNode.removeChild(tr);
}else{
alert("删除失败");
}
});
}
</script>
<script src='/dwr/interface/maildao.js'></script>
<script src='/dwr/util.js'></script>
<script src='/dwr/engine.js'></script>
</head>
<body>
<s:property value="msg"/><br>
<s:include value="top.jsp"></s:include>
<hr color="red">
<table border="1" width="80%" align="center">
<tr>
<th>标题</th><th>内容</th><th>操作</th>
</tr>
<s:iterator value="#session.user.sendMails" var="mails">
<tr>
<td>
<s:property value="#mail