超链接删除
来源:互联网 发布:搜索一下淘宝网 编辑:程序博客网 时间:2024/05/22 05:13
页面:
<script type="text/javascript">
//删除照片function delParkingPhoto(id){
$.ajax({
url:"../../app/parkingphoto/parking-photo-del?id="+id,
type:"POST",
});
//删除以后重新刷新页面
location.reload(true);
}
</script>
<a href="JavaScript:delParkingPhoto('${pp.id}')" onclick="return confirm('确定删除此照片')" rel="external">删除</a>
后台代码:
@Path("parking-photo-del")
@POST
@Produces({ MediaType.APPLICATION_JSON })
public String delPhoto(@QueryParam("id") String id) throws IOException{
String msg="";
try {
if(id!=null || id!=""){
ParkingPhoto pp=jpaTemplate.find(ParkingPhoto.class, id);
//删除照片表中的记录
TransactionTemplate tt=app.getTransactionTemplate();
tt.execute(new TransactionCallback<Object>(){
String id;
public TransactionCallback<?> setId(String id){
this.id = id;
return this;
}
@Override
public Object doInTransaction(TransactionStatus status) {
try{
ParkingPhoto pp=jpaTemplate.find(ParkingPhoto.class, id);
jpaTemplate.remove(pp);
}catch(Exception e){
System.out.println("未找到照片信息");
}
return null;
}
}.setId(id));
//删除文件夹下面的照片
RequestContext rctx=RequestContext.get();
String realPath = rctx.getServletContext().getRealPath(pp.getPath());
File file = new File(realPath);
if(file.exists() && file.isFile())
file.delete();
msg="删除成功!";
System.out.println("删除成功");
}
} catch (Exception e) {
e.printStackTrace();
msg="对不起,删除失败!";
System.out.println("删除失败");
}
return msg;
}
- 超链接删除
- Word批量删除超链接
- html超链接确认删除
- word删除超链接的方法
- 删除word里的超链接
- 快速删除word中的超链接
- 桌面上不能删除的超链接
- 一键批量删除超链接
- 用按钮来做超链接 确认删除
- 怎样删除WORD文档中的所有超链接
- 如何统一删除word中的超链接
- js为超链接添加删除确定脚本
- 超链接
- 超链接
- 超链接
- 超链接
- 超链接
- 超链接
- AVI文件格式
- Paxos在大型系统中常见的应用场景
- WiEngine游戏引擎学习笔记(一)
- 股票指数期货
- 线程分离状态
- 超链接删除
- Word上下标符号怎么打
- 从硬盘完整安装windows 2003(非Ghost)
- 设计模式--代理模式(Proxy)
- 修改Datagridview并保存到数据库
- 指向多维数组的指针变量
- 连接多台服务器数据库,如遇超时或网络不通自动跳过连接下一台
- Ant系统属性
- qlikview工作表对象(图表)的用法