0

I'm stuck with a problem:

  1. i have an array of object in vuejs TablePlayers[] this.TablePlayers.push({'message': this.returnmsg, 'player': true, 'Time': time});
  2. i send it to my java controller with:

axios.get("http://localhost:8080/SetTablePlayers/"+this.TablePlayers)

then i add this table of object to java session with : HttpSession session = request.getSession(); session.setAttribute("TablePlayers", TablePlayers);

3.and when i would get this object from session :

TablePlayers= (List<Players>)session.getAttribute("TablePlayers");

it returns null. how can i fix that thanks, and this is right?

Strazan
  • 147
  • 1
  • 16
Houssem
  • 41
  • 7

1 Answers1

0

You cannot send your JSON data that way. Please use an http POST method and send the data into the body of the request.

axios.post("http://localhost:8080/SetTablePlayers/", this.TablePlayers)

of course you have to adapt also your server code.

GET method should be used to obtain something from the server instead.

tarabor
  • 166
  • 1
  • 7
  • Obviously, I'm talking about convention https://www.w3schools.com/tags/ref_httpmethods.asp but if you want absolutely send the JSON data via GET I suggest you to read here: https://stackoverflow.com/questions/27577922/how-to-pass-a-json-array-as-a-parameter-in-url – tarabor Apr 11 '19 at 12:13