java - 在 JSP 页面中包含 Applet

标签 java jsp applet

我编写了一个绘制饼图的 Applet 程序。 applet 的值应该从 JSP 页面传递。

我在 JSP 中写了下面几行代码:

<jsp:plugin type="applet" code="drawPie" codebase="." width="750" heigth="300">
    <jsp:params>  
        <jsp:param name="user_id" value="<% =user %>"/>
    </jsp:params>    
</jsp:plugin>     

在我使用的小程序中

String user=getParameter("user_id");

当我打开 jsp 页面时,既没有错误也没有图表。

上述代码片段中的问题/错误是什么?

最佳答案

如图this reference , 你必须包括 .classcode属性:

The name of the Java class file that the plugin will execute. You must include the .class extension in the name following code. The filename is relative to the directory named in the codebase attribute.

<jsp:plugin type="applet" code="drawPie.class" codebase="." 
     width="750" heigth="300">

我还建议提供/查看生成的 HTML 代码以查看它是否正确 <object>标签。

关于java - 在 JSP 页面中包含 Applet,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2605111/

相关文章:

Java while 循环不限制范围?

java - Primefaces DialogFramework Growl 和 showMessageInDialog 不工作

java - 如何给两个不同的类同一个接口(interface)?

applet - 用于确定 'latest Java version' 的 Oracle 或第 3 方服务

java - 从 Javascript 调用 Java 的 Desktop.open 方法 - 访问被拒绝 java.awt.AWTPermission showWindowWithoutWarningBanner

java - 跨越几个jvm的锁?

java - 如何在JSP中仅单击一个按钮即可执行两个操作?

java - 如何遍历jsp中的异常原因链

css - Spring 启动 : Adding static content to web application

java - 如何修改此程序以包含可用于更改此小程序的背景颜色的八种颜色的 JList?