I am using Spring 4 to develop a web application.
I have this Controller
@RequestMapping(value = "/submitIdesFalse", method = RequestMethod.POST)
public void setSubmitIdesFalse(Map<String, Object> model, Locale loc) throws UnknownHostException, DataIntegrityViolationException, DataException, MysqlDataTruncation{
final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
final String userName = authentication.getName();
final Company company = companyService.getCompanyByUser(userName);
final Integer reportingYear = java.util.Calendar.getInstance().get(java.util.Calendar.YEAR) - 1; // Previous year
final License license = licenseService.getLicense(company.getId(), reportingYear);
if(license.getIsSubmitted()){
log.debug("Files already submitted");
}else{
Date date = new Date();
license.setId(license.getId());
license.setIsSubmitted(true);
license.setDateSubmitted(new Timestamp(date.getTime()));
license.setUserSubmitted(userName);
licenseService.saveLicense(license);
log.debug("User Name is: " + userName);
log.debug("Company " + company.getName() + " set to Submitted FATCA Status");
final String emailList = this.fatcaWebProperties.getProperty(ApplicationPropertyName.EMAIL_LIST.getPropertyName());
final String[] emailListSplited = emailList.split(",");
final InetAddress ip = InetAddress.getLocalHost();
final TimeZone timeZone = TimeZone.getTimeZone("Canada/Eastern");
final String localDateTime = FatcaWebUtility.getDate();
final String opesDateTime = FatcaWebUtility.getDateWithTimeZone(timeZone);
final String companyName = company.getName();
final Long companyId = company.getId();
if(!company.getName().equals("OPES")){
for (int i = 0; i < emailListSplited.length; i++) {
emailSenderService.sendSubmittedOpesMail(ip, emailListSplited[i], companyId, companyName, localDateTime, opesDateTime, userName);
}
}
}
It's a void method and the form that calls this page is:
<form:form method="post" action="submitIdesFalse.html">
<input type="submit" id="sendGenerateSubmit" value="Generate and Submit" />
</form:form>
After the controller is called it returns a 404 page saying that submitIdesFalse.jsp
was not found but my controller is void
I tried to make the method return a String
and it returns the page I call, but when I set void
it returns this weird 404.
I posted all my controller to make sure I am not missing anything, sorry about the amount of code.
By the way, I am using Tomcat 7
.
Any ideas?