1.搭建开发环境
struts2的jar包+struts2的配置文件+web.xml中的拦截器
hibernate的jar包+hibernate.cfg.xml+相应的类+映射文件
****
因为我们要实现页面无刷新,所以要添加struts2-json-plugin.jar
添加dao 层
其中finAll()
delete(Long id) --------->findOnebyId(long id)
update(person)
Aciton层
类 extends ActionSupport implements ModelDriven<Person>
//实现模型驱动,目的是为了数据封装。
struts2.xml
<action name="personAction_*" method="{1}" class="com.jplus.aciton.PersonAction">
<result type="json"></result>
</action>
person.js
$.post("personAction_deletePerson.action", { "pid":this.id },
function(data){
//如果删除成功后,就将tr 删除掉,首先将其转换为jquery 对象
$(obja).parent().parent().remove(); //也就是自己将自己删除掉
});