简体   繁体   English

在JSP页面中包括Applet

[英]Including Applet in JSP page

I wrote an Applet program which draws a pie chart. 我写了一个Applet程序来绘制饼图。 The values for the applet should be passed from JSP page. applet的值应从JSP页面传递。

I wrote the following lines of code in 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>     

and in applet I used 在小程序中

String user=getParameter("user_id");

when I open the jsp page nothing comes neither error nor the chart. 当我打开jsp页面时,什么也不会出现错误或图表。

What is the problem/error in the above code snippet? 以上代码段中的问题/错误是什么?

As shown in this reference , you have to include .class in the code attribute: 本参考资料所示,您必须在code属性中包含.class

The name of the Java class file that the plugin will execute. 插件将执行的Java类文件的名称。 You must include the .class extension in the name following code. 您必须在以下代码的名称中包括.class扩展名。 The filename is relative to the directory named in the codebase attribute. 文件名是相对于在codebase属性中命名的目录的。

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

I'd also suggest giving/looking at the generated HTML code to see if it is proper <object> tag. 我还建议给出/查看生成的HTML代码,以查看它是否正确的<object>标签。

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

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