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?

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Obviously, I'm talking about convention w3schools.com/tags/ref_httpmethods.asp but if you want absolutely send the JSON data via GET I suggest you to read here: stackoverflow.com/questions/27577922/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.