将 Java Applet 上传到网页中
我使用 netbeans 6.0 创建了一个 java 字母游戏小程序,它还有一个用于高分的 Microsoft Access 数据库。 我想将其上传到网页(例如在 miniclip facebook 等上如何完成)我想知道如何完成
I have created a java letter game applet using netbeans 6.0 which also has a Microsoft Access Database for the High Scores.
I want to upload it into a webpage (like how its done on miniclip facebook etc) I'd like to know how it could be done
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不确定你所说的“将其上传到网页”是什么意思。 Applet 使用
此外,直接从小程序访问数据库是一个非常糟糕的主意,因为小程序代码(每个人都可以全局访问)需要包含数据库用户和密码,这意味着每个费心反编译小程序的人都可以做任何事情他们想要(并且允许该用户)使用数据库。 至少,他们将能够进入童话般的高分(例如,当一场完美的游戏让你获得 1000 分时,你可以得到 5000 万分)。
I'm not sure what you mean with "upload it into a webpage". Applets are embedded into webpages using the
<applet>
tag or the<object>
tag. However, the Access DB could become a problem, since it is poorly suited to an internet app with potentially many concurrent users.Additionally, accessing a DB directly from an applet is a very bad idea, since the applet code (which is globally accessible to everyone) will need to contain the DB user and password, which means that everyone who bothers to decompile the applet can do whatever they want (and that user is allowed) to do with the DB. At the very least, they'll be able to enter fairy tale highscores (e.g. 50 million when a perfect game gets you 1000).
正如 Michal Borgwardt 所说,为了将实际的小程序放在您的页面上,您需要上传已编译的类文件,然后使用小程序或对象标记。
为了获得高分,您需要使用 Web 服务器上的数据库(例如 MySQL)并使用 PHP 或 ASP 或您选择的其他 Web 语言编写一个与其接口的页面。 然后,您可以让小程序打开指定的页面,为其提供玩家姓名、分数等 POST 参数。此外,由于此类内容可能会被欺骗,因此您需要找到一种方法来防止人们自己打开页面带有虚假姓名和分数条目。
As Michal Borgwardt said, in order to put the actual applet on your page you upload the compiled class file and then use an applet or object tag.
For high scores, you need to use a database on your web server (such as MySQL) and write a page that interfaces it using PHP or ASP or your other web language of choice. You would then have the applet open the specified page, giving it POST parameters of the player's name, score, etc. Also, since things like that can be spoofed, you need to figure out a way to prevent people from just opening the page themselves with bogus name and score entries.