HttpServletRequest request, HttpServletResponse response)
throws Exception
{
checkAuthorization( request);
final TemplateProjectService service = getService(TemplateProjectService.class);
//This segment valildates the UploadFormFile form manually because automatic Struts validation does not work.
final ActionErrors errors = new ActionErrors();
final String typeId = ((UploadFileForm) form).getMyFileTypeId().trim();
if(typeId.length()< 1)
{
errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("uploadFile.typeId"));
}
if(((UploadFileForm) form).getMyFile().getFileSize()< 1)
{
errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("uploadFile.file"));
}
if(!errors.isEmpty())
{
saveErrors(request, errors);
return mapping.getInputForward();
}
final UploadFileVo ufvo = new UploadFileVo();
BeanUtils.copyProperties(ufvo, form);
service.saveProjectFile(ufvo);
return mapping.findForward(WebConstants.FORWARD_VIEW);
}