У меня проблемы с перенаправлением ссылки кода ниже на мой класс контроллера.
Это код:
$('#ticketDT').DataTable({
"dom": '<"toolbar">frtip',
"responsive": true,
"ordering": false,
"scrollY": "300px",
"scrollCollapse": true,
"ajax": "ticketList.json",
"bDestroy": true,
"deferRender": true,
"aoColumns": [
{"mData": "ticketNumber"},
{"mData": "category"},
{"mData": "subcategory"},
{"mData": "status"},
{"mData": "requestedBy"},
{"mData": "ticketNumber",
"fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {
$(nTd).html("<a class='linkColor' href='${pageContext.request.contextPath}/assignMessageTicket?sender_assign=" + encodeURIComponent(sender) + "&portId_assign="+portId+"&messageId=" + encodeURIComponent(messageId) + "&ticketNumber_assign=" + encodeURIComponent(oData.ticketNumber) + "'><span data-toggle='tooltip' title='Assign'><i class='ti-plus btn btn-simple btn-assign btn-icon' data-mode='assignTicket'></i></span></a>");
}
}
],
Это мой обработчик для класса контроллера:
@RequestMapping(value = {"assignMessageTicket"}, method = RequestMethod.GET)
@PreAuthorize("hasAnyRole('CWO_ENCODER,ADMIN')")
public ModelAndView assignMessageTicket(@RequestParam(value = "sender_assign",required = true) String sender,
@RequestParam(value = "portId_assign",required = true) String portId,@RequestParam(value = "messageId",required = true) String messageId,
@RequestParam(value = "ticketNumber_assign",required = true) String ticketNumber,
ModelMap model,HttpServletRequest request) throws UnsupportedEncodingException {
String currentUser = request.getRemoteUser();
SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/YYYY");
Date date = new Date();
String currentDate = formatter.format(date);
dashboardService.assignMessageSmsMessages(messageId,ticketNumber);
dashboardService.assignMessageSmsReply(messageId,ticketNumber);
dashboardService.addRecentlyAssignedMessage(sender,portId,ticketNumber,currentUser,currentDate);
String newSender = URLEncoder.encode(sender, "UTF-8").replaceAll("\\+", "%2B");
String newPortId = URLEncoder.encode(portId, "UTF-8").replaceAll("\\+", "%2B");
boolean hasError = false;
model.clear();
return new ModelAndView("redirect:conversation?sender="+newSender+"&portId="+newPortId+"&hasError="+hasError);
}
Это мой обновленный код.
Ссылка на контроллер
$(nTd).html("<a class='linkColor' href='${pageContext.request.contextPath}/assignSpecificMessage?messageId="+messageId+"&sender_assign=" + encodeURIComponent(sender) + "&portId_assign="+portId+"&ticketNumber_assign=" + encodeURIComponent(oData.ticketNumber) + "'><span data-toggle='tooltip' title='Assign'><i class='ti-plus btn btn-simple btn-assign btn-icon' data-mode='assignMessageTicket'></i></span></a>");
Контроллер
@RequestMapping(value = {"assignSpecificMessage"}, method = RequestMethod.GET)
@PreAuthorize("hasAnyRole('CWO_ENCODER,ADMIN')")
public String assignSpecific(@RequestParam(value = "sender_assign",required = true) String sender,
@RequestParam(value = "portId_assign",required = true) String portId,@RequestParam(value = "messageId",required = true) String messageId,
@RequestParam(value = "ticketNumber_assign",required = true) String ticketNumber,
ModelMap model,HttpServletRequest request) {
return "conversation";
}
Я пытался создать новый обработчик, чтобы проверить его, Тем не менее, появляется та же ошибка.