我编写了一个绘制饼图的 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 , 你必须包括 .class
在code
属性:
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/