I want to select query from my database. I need to find from a list because it has many search items in the same query. So I want to get the list to do that. Select query works very well when I add Model.addattribute
. But I don't want that. I want to do it from Ajax. So I want to pass the list to another control which is written for ajax. So please someone help me to do that.
This is my controller class which get my page
@RequestMapping(path = "/applicationManage")
public String viewApplicationPage(Model model) {
Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
long userId = 0;
String agency = "";
String units = "";
List<String> unitsSLSI;
if (principal != null && principal instanceof AuthenticatedUser) {
AuthenticatedUser auth = (AuthenticatedUser) principal;
userId = auth.getUserId();
agency = auth.getAgency();
unitsSLSI = auth.getJobUnits();
}
return "applicationManage";
}
I want to pass unitsSLSI
list to my another controller? The rest service (ajax) controller is
@RequestMapping(value = "/SLSIApp", produces = {MediaType.APPLICATION_JSON_VALUE}, method = RequestMethod.GET)
@JsonIgnore
public ResponseEntity<List<SLSNotification>> listAllSLSI(List<String> unitList) {
List<SLSNotification> appbyUserID = jservice.getApplicationsByUnit(unitList);
if (appbyUserID.isEmpty()) {
return new ResponseEntity<List<SLSNotification>>(HttpStatus.NO_CONTENT);//You many decide to return HttpStatus.NOT_FOUND
}
System.out.println("hibernate query " + new ResponseEntity<List<SLSNotification>>(appbyUserID, HttpStatus.OK));
return new ResponseEntity<List<SLSNotification>>(appbyUserID, HttpStatus.OK);
}
when I add this cord
List<SLSNotification> appbyUserID = jservice.getApplicationsByUnit(unitList);
I want to get unitList
from my previous controller because it has my search list. How can I do that?
删除@JsonIgnore
,使您的响应变得充满生气...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.