// 更新 @Validations( requiredStrings = { @RequiredStringValidator(fieldName = "friendLink.name", message = "友情链接名称不允许为空!"), @RequiredStringValidator(fieldName = "friendLink.url", message = "链接地址不允许为空!") }, intRangeFields = { @IntRangeFieldValidator( fieldName = "friendLink.orderList", min = "0", message = "排序必须为零或正整数!") }) @InputConfig(resultName = "error") public String update() throws Exception { FriendLink persistent = friendLinkService.load(id); if (logo != null) { String logoPath = ImageUtil.copyImageFile(getServletContext(), logo); persistent.setLogoPath(logoPath); } BeanUtils.copyProperties( friendLink, persistent, new String[] {"id", "createDate", "modifyDate", "logoPath"}); friendLinkService.update(persistent); redirectUrl = "friend_link!list.action"; return SUCCESS; }
// 保存 @Validations( requiredStrings = { @RequiredStringValidator(fieldName = "friendLink.name", message = "友情链接名称不允许为空!"), @RequiredStringValidator(fieldName = "friendLink.url", message = "链接地址不允许为空!") }, intRangeFields = { @IntRangeFieldValidator( fieldName = "friendLink.orderList", min = "0", message = "排序必须为零或正整数!") }) @InputConfig(resultName = "error") public String save() throws Exception { if (logo != null) { String logoPath = ImageUtil.copyImageFile(getServletContext(), logo); friendLink.setLogoPath(logoPath); } else { friendLink.setLogoPath(null); } friendLinkService.save(friendLink); redirectUrl = "friend_link!list.action"; return SUCCESS; }
// 列表 public String list() { pager = friendLinkService.findPager(pager); return LIST; }
// 删除 public String delete() { friendLinkService.delete(ids); return ajax(Status.success, "删除成功!"); }
// 编辑 public String edit() { friendLink = friendLinkService.load(id); return INPUT; }