简体   繁体   English

使用具有Mysql Connector的html来运行Applet

[英]Running an Applet with html Having Mysql Connector

Hi Guys I have This Applet that Displays with the Error as I have Posted Below. 嗨,大家好,我有这个小程序,显示错误,如下所示。 The Screen Shot of my build folder also is there Where Do I place the mysql-connector-java-5.1.13-bin.jar file so that It can connect with My Applet from a Web Browser??? 我的build文件夹的屏幕快照也位于哪里放置mysql-connector-java-5.1.13-bin.jar文件,以便它可以从Web浏览器与My Applet连接?

The Applet Runs well When I run it manually as the Mysql Jar is in the Class path. 当Mysql Jar位于Class路径中时,手动运行Applet时效果很好。 我的网上申请

Here is My Build Directory: 这是我的构建目录: 建立

My Login.html File looks like this : 我的Login.html文件如下所示:

<HTML>
<HEAD>
<TITLE>MY Applet</TITLE>
</HEAD>
<BODY>



<H3><HR WIDTH="100%">My Applet<HR WIDTH="100%"></H3>

<P>
<APPLET codebase="classes" code="Login.class" width=350 height=200></APPLET>
</P>

<HR WIDTH="100%"><FONT SIZE=-1><I>Generated by NetBeans IDE</I></FONT>
</BODY>
</HTML>

It the applet element is: applet元素是:

<APPLET 
    codebase="classes" 
    code="Login" 
    archive="mysql-connector-java-5.1.13-bin.jar"
    width=350 
    height=200>
</APPLET>

The archive would need to be located at: 归档文件必须位于:

classes/mysql-connector-java-5.1.13-bin.jar

But Alex is right about the part that an applet should not have direct access to the DB. 但是Alex关于小程序不应直接访问数据库这一部分是正确的。 The DB should be placed behind an interface (eg a web-app.) that hides the details of the server, authenticates users, and regulates user activity. 数据库应放置在隐藏服务器详细信息,验证用户身份和管理用户活动的界面(例如Web应用程序)后面。

You should never implement applet that uses database directly. 您永远不应实现直接使用数据库的applet。 Applet by definition runs in browser and should talk to server via HTTP only. 根据定义,Applet在浏览器中运行,并且应该仅通过HTTP与服务器通信。 You should implement server side component that exposes Web service API (soap, rest, whatever). 您应该实现公开Web服务API的服务器端组件(肥皂,其他任何东西)。 The server side component should work with DB while applet should work with the API exposed by this component. 服务器端组件应与DB一起使用,而小程序应与该组件公开的API一起使用。

EDIT. 编辑。 You can however add mysql driver to the applet classpath. 但是,您可以将mysql驱动程序添加到applet类路径中。 It will probably work for you while both DB and browser are running on the same machine but will fail for regular user that is typically behind firewall. 当数据库和浏览器都在同一台计算机上运行时,它可能对您有用,但对于通常位于防火墙后面的普通用户而言,它将失败。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM