Reputation: 90
Ok, basically I have a game that I want to be able to upload and download data (highscores) so the user can see it.
My trouble is that I don't know how to upload their score to the server. I would not know where to start with making the program download the information (I want it to only download the needed information. In the past I have had to download an entire website to scan it for the needed information!).
If this question has already been asked, I'm sorry but I have searched for answer for over 2 hours now!
Upvotes: 0
Views: 71
Reputation: 5256
Ok here's how this works :
You'll have 3 main components - JSP(because you tagged Java), Servlet and
Java class.
JSP, the web page will be loaded on client machine and the other 2 will be on
server along with the db.
From JSP or the web page you'll make a request
(either synchronous or asynchronous).
synchronous : by submitting a form to the servlet
asynchronous : by calling servlet method without submitting any for(AJAX)
Now this request will either be for saving HighScore or retrieving HighScore,
therefore it will call the respective method from server(the servlet)
and which in turn will call methods from Java Class(DAO, data access object).
DOA will return the required value or will store the value depending
on the request.
You do not need to download any website and search data in it. Just make requests and handle responses.
Guide for servlets : http://www.tutorialspoint.com/servlets/
Upvotes: 0
Reputation: 227
HttpRequest needs to be used here. You can send data (JSON recommended) from your JAVA code to the server, and the server stores it in DB. This topic is too broad, so I recommend you to look through HttpRequest first.
Upvotes: 1