簡體   English   中英

如何發送和接收信息到網頁?

[英]How do I send and receive information to a web page?

好的,基本上我有一個我希望能夠上傳和下載數據(高分)的游戲,以便用戶可以看到它。

我的麻煩是我不知道如何將他們的分數上傳到服務器。 我不知道從哪里開始使程序下載信息(我希望它僅下載所需的信息。過去,我不得不下載整個網站以掃描所需的信息!)。

如果已經問過這個問題,很抱歉,但是我已經搜索了2個多小時的答案!

這里需要使用HttpRequest。 您可以將JAVA代碼中的數據(建議使用JSON)發送到服務器,然后服務器將其存儲在DB中。 這個主題太廣泛了,因此我建議您先瀏覽HttpRequest。

好的,這是這樣的:

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.

您無需下載任何網站並在其中搜索數據。 只需提出請求並處理響應即可。

Servlet指南: http : //www.tutorialspoint.com/servlets/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM