In a browser I have a box where I can enter multiple inputs something like PQRS-CD-12345(PQRS-CD come by default only the numbers 12345 keep changing) separated by a comma. When I click on enter it should say successfully submitted.
The problem is that I can see a success message only when I enter values like below PQRS-CD-12345,PQRS-CD-56478,PQRS-CD-75631 (without any spaces after comma).
If I enter something like PQRS-CD-12345, PQRS-CD-86452, PQRS-CD-22551(with enter and spaces between values) it then gives me an error message saying that:
An unknown error has occurred. Message:org.springframework.dao.EmptyResultDataAccessException: No entity found for query No entity found for query.
My current part of code is
@PreAuthorize("hasAnyRole('jobdetail_admin')")
@RequestMapping(value="/hub/showBulkResendPage")
public ModelAndView showBulkResendPage(HttpServletRequest request, HttpServletResponse response)
{
ModelMap map = new ModelMap();
map.put("maxLimitOrdTextarea", maxLimitOrderTextarea);
return new ModelAndView("bulkResend", map);
}
@PreAuthorize("hasAnyRole('jobdetail_admin')")
@RequestMapping(value="/hub/bulkResendStatus")
public ModelAndView bulkResendStatus(HttpServletRequest request, HttpServletResponse response) throws ServletRequestBindingException
{
String successView = "redirect:/ipod/hub/searchOrderOrJob";
***String[] prtrOrdLocs = ServletRequestUtils.getRequiredStringParameter(request, "prtrOrdLocs").split(",");*** (i added this part commenting the below line)
// String[] prtrOrdLocs = request.getParameter("prtrOrdLocs").split(",");
System.out.println(prtrOrdLocs);
ModelAndView modelAndView = null;
ModelMap map = new ModelMap();
try
{
for(String orderLocator : prtrOrdLocs)
{
orderLocator = orderLocator.replaceAll("[\\n\\s]", ""); // i added this line
orderService.resendStatus(orderLocator);
}
map = new ModelMap();
map.put("success", "resendstatus.hub.success");
modelAndView = new ModelAndView(successView, map);
}
catch(IPODException e)
{ e.printStackTrace();
modelAndView = handleException(e,"resendstatus.hub.error");
}
catch(Exception e)
{
e.printStackTrace();
}
return modelAndView;
}
In spite of adding those new lines I still get the same output. Can anyone help me?
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<head>
<script type="text/javascript">
setupValidateBulkResendTextbox();
</script>
<link rel="stylesheet" type="text/css" href="/css/menuItem-utilities.css" />
</head>
<%@include file="/jsp/layout/submenu-utilities.jsp"%>
<div id="main-content">
<h2>Bulk Resend Status</h2>
<div align="center">
<div align="center" class="errortxt" id="error-message">${usermsg}</div>
<div align="center" id="success-message">${success}</div>
<sec:authorize access="hasAnyRole('jobdetail_admin')" >
<form name="formBulkResendPrtrOrdLocator" id="formBulkResendPrtrOrdLocator" action="/ipod/hub/bulkResendStatus" method="post">
Enter valid, distinct partner order locator IDs separated by commas:
<br /><input type="hidden" name="maxLimitOrdTextarea" value="${maxLimitOrdTextarea}" />
<textarea id="prtrOrdLocs" name="prtrOrdLocs" rows="20" cols="40" /></textarea><br />
<div id="errors" class="errortxt"></div>
<input type="submit" value="Bulk Resend" class="inputbutton" />
</form>
</sec:authorize>
</div>
</div>