Ich möchte Abfrage aus meiner Datenbank auswählen. Ich muss aus einer Liste suchen, da es viele Suchelemente in derselben Abfrage enthält. Also ich möchte die Liste dafür bekommen. Select Query funktioniert sehr gut, wenn ich Model.addattribute
hinzufüge. Aber das will ich nicht. Ich möchte es von Ajax machen. Also möchte ich die Liste an ein anderes Steuerelement übergeben, das für Ajax geschrieben ist. Also bitte hilf mir, das zu tun.Wie LIST von einem Controller an einen anderen Controller im Frühjahr übergeben mvc
Das ist mein Controller-Klasse, die meine Seite bekommen
@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";
}
ich unitsSLSI
Liste meiner anderen Controller übergeben möchten? Der Rest Service (Ajax) Controller ist
@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);
}
, wenn ich diese Schnur hinzufügen
List<SLSNotification> appbyUserID = jservice.getApplicationsByUnit(unitList);
Ich möchte unitList
von meinem früheren Controller erhalten, weil es meine Suche-Liste. Wie kann ich das machen?
Möglicherweise müssen auch @ResponseBody zu diesem listAllSLSI hinzuzufügen. –
Nein, er antwortet Antwort Entity, so dass alles, was er braucht. – Antoniossss
@Antoniossss ..Wie zu diesem ... Ich kann verstehen, dies zu tun –