美好的一天,伙计们。我有 DAO 方法来删除一些文件。
@Override
public void deleteFormDescription(Date formDate, String institutionName) {
Session session = sessionFactory.getCurrentSession();
Integer dateId = fetchDateId(formDate);
Integer institutionId = fetchInstitutionId(institutionName);
if(dateId == null && institutionId == null) {
throw new UnexpectedRollbackException("Transaction will roll back because, dateId: " + dateId + " and institutionId: " + institutionId);
}
try {
FormDescription formDescription = (FormDescription)session.createCriteria(FormDescription.class, "formDescription")
.createAlias("formDescription.institutions", "institution").add(Restrictions.eq("institution.institutionId", institutionId))
.createAlias("formDescription.formDate", "formDate").add(Restrictions.eq("formDate.dateId", dateId)).uniqueResult();
session.delete(formDescription);
session.flush();
} catch(RuntimeException e) {
throw new UnexpectedRollbackException("Transaction will roll back because " +
" method deleteFormDescription(Date formDate, String institutionName) could not delete an FormDescription");
}
}
在我的控制器中,我有:
@RequestMapping(value="/deleteprocessing", method=RequestMethod.GET)
public String deleteProcessing(@RequestParam String particularDate,
@RequestParam String institutionName) throws Exception {
educationWebService.deleteFormDescriptionService(dateConvertation(particularDate), institutionName);
return "redirect:/delete";
}
我需要在 JSP 页面上呈现此方法,该页面将他的删除文件归档。是否有可能做到这一点?感谢你们。