Hara Chaitanya
Hara Chaitanya

Reputation: 998

Including Applet in JSP page

I wrote an Applet program which draws a pie chart. The values for the applet should be passed from JSP page.

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

What is the problem/error in the above code snippet?

Upvotes: 1

Views: 2399

Answers (1)

Bozho
Bozho

Reputation: 597106

As shown in this reference, you have to include .class in the code attribute:

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">

I'd also suggest giving/looking at the generated HTML code to see if it is proper <object> tag.

Upvotes: 3

Related Questions