This week's book giveaway is in the Jobs Discussion forum. We're giving away four copies of Developer Career Masterplan: Build your path to senior level and beyond with practical insights from industry experts and have Heather VanCura and Bruno Souza on-line! See this thread for details.
I am currently working on my backend part for my React web application. I have created my project as maven and from there created the web folder with ReactJS. So I have my backend part in src and frontend in the web folder.
I have some challenges with my backend part which is in the programming language java. I am in the process of developing it so that it cooperates with my frontend.
My Backend (Order.java) looks like this:
I'm working on programming my backend api to display my data like this:
I have tried and created an array called orderedItems with various values. But I just can't get it to make sense. I've tried to do this, but it doesn't work.
The code above gives me error, I've no idea why it should.
Can someone help me converting the format to java code?
Trying to get my backend api to work. I just need to make so my backend prints the data as the format shown above.
Tim Cooke wrote:Please don't edit your posts after replies have been made as it makes it look like the other participants in the conversation haven't read your question properly and makes their post look like nonsense.
Conversations go forwards in time, so answer questions and add more information as a replies.
Jeanne Boyarsky wrote:What is the exact error message you are getting? Can you show the context of the code (that shows the three variables you reference)?
Here's the error from the console:
The code above gives me error 415. I've found out that 415 error means unsupported Media Type client error response code indicates that the server refuses to accept the request because the payload format is in an unsupported format. So it might be with the format I am sending from my backend and my frontend has another format, is that correct?
Here's how I am using the POST request in my frontend: