redirigir a otra lista de URL de objetos
Frecuentes
Visto 396 equipos
0
I've got this method in MVC controller
public String save(
@RequestParam("id") Long id,
@RequestParam(value = "book", required = false) List<Long> books,
@RequestParam(value = "bookNow", required = false) List<Long> booksNow) {
if (booksNow != null)
return "redirect:/saveNow.html?id=" + id + "&bookNow=" + booksNow;
But the problem is that I want to redirect to another method my list of objects booksNow
if it is not null.
@RequestMapping(value = "/saveNow.html", method = RequestMethod.GET)
public String saveNow(
@RequestParam("id") Long id,
@RequestParam(value = "bookNow", required = true) List<Long> booksNow) {
pero tengo un error
The request sent by the client was syntactically incorrect.
What is the proper way to redirect list of objects?
1 Respuestas
1
"&bookNow=" + booksNow
no tiene sentido.
booksNow will just print some java object something like List@1e23
You need to loop through the list so that your URL looks like so:
"redirect:/saveNow.html?id=123&bookNow=234&bookNow=235&bookNow=236
contestado el 28 de mayo de 14 a las 17:05
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas spring-mvc or haz tu propia pregunta.