• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

embedding applets

 
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,

I'm trying to embed an applet into a JSP page. My source code for the JSP page looks like this:

NOTE: I had to replace the ':' character with the actual word "colon" in order to prevent these dumb smiley faces from appearing!

<jsp colon plugin type="applet" code="mvcs.TableForm.class" codebase="." width="400" height="300">
<jsp colon params>
<jsp colon param name="action" value="<%=AppletAction%>" />
<jsp colon param name="redirect" value="<%=AppletRedirect%>" />
<jsp colon param name="CompanyID" value="<%=companyID%>" />
<jsp colon param name="AdministratorID" value="" />
<jsp colon param name="RecordLimit" value="40" />
<jsp colon param name="OnErrorPage" value="<%=AppletError%>" />
</jsp colon params>
<jsp colon fallback>
<B>Error: Unable to load Applet.<br>This page requires the Java Virtual Machine version 1.5 or greater to run.
</jsp colon fallback>
</jsp colon plugin>

When I load the page into Internet Explorer the applet loads just fine. Different story with Netscape though. It won't load in Netscape. When I look at the source page after attempting to load the applet in Netscape it looks like this:

<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" width="400" height="300" codebase="http://java.sun.com/products/plugin/1.2.2/jinstall-1_2_2-win.cab#Version=1,2,2,0">
<PARAM name="java_code" value="mvcs.TableForm.class">
<PARAM name="java_codebase" value=".">

<PARAM name="type" value="application/x-java-applet;">
<PARAM name="action" value="http://localhost:8080/scholastic/AddStudentTableData">
<PARAM name="redirect" value="http://localhost:8080/scholastic/admin/SuccessfulTransaction.jsp">
<PARAM name="CompanyID" value="4">
<PARAM name="AdministratorID" value="">
<PARAM name="RecordLimit" value="40">
<PARAM name="OnErrorPage" value="http://localhost:8080/scholastic/admin/AdminMainMenu.jsp">
<COMMENT>
<EMBED type="application/x-java-applet;" width="400" height="300" pluginspage="http://java.sun.com/products/plugin/" java_code="mvcs.TableForm.class" java_codebase="." action="http://localhost:8080/scholastic/AddStudentTableData" redirect="http://localhost:8080/scholastic/admin/SuccessfulTransaction.jsp" CompanyID="4" AdministratorID="" RecordLimit="40" OnErrorPage="http://localhost:8080/scholastic/admin/AdminMainMenu.jsp"/>
<NOEMBED>

<B>Error: Unable to load Applet.<br>This page requires the Java Virtual Machine version 1.5 or greater to run.

</NOEMBED>
</COMMENT>
</OBJECT>

I compared this with the source in IE and they're the same. Has anyone had this same type of difficulty? For the heck of it, to prove there was nothing wrong with the applet itself, I created a test html page that simply used the <applet></applet> tags:

<applet code="mvcs.TableForm.class" width="400" height="300">
<PARAM name="action" value="http://localhost:8080/scholastic/AddStudentTableData">
<PARAM name="redirect" value="http://localhost:8080/scholastic/admin/SuccessfulTransaction.jsp">
<PARAM name="CompanyID" value="4">
<PARAM name="AdministratorID" value="">
<PARAM name="RecordLimit" value="40">
<PARAM name="OnErrorPage" value="http://localhost:8080/scholastic/admin/AdminMainMenu.jsp">

</applet>

Netscape didn't have a problem with this and loaded the applet fine. So what's wrong with the other code that uses the OBJECT and EMBED tags?

Alan
[ October 26, 2005: Message edited by: Alan Shiers ]
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since the issue is with browser interpretation of the same generated HTML, this is clearly not a problem with your JSP code. So I'm moving this off to the Applets forum where the applet-savvy hang out.

P.S. If you click the 'disable smilies' button when posting code, your tags will look a little less disrespectful.

P.P.S. It might be helpful to point out what versions of the browsers that you are using.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I never got the hang of the OBJECT and EMBED tags. If APPLET works, why not just use that? My impression is that it works more widely than the other ones, and that the jsp:plugin tag is a relict of times past.
 
Alan Shiers
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, I found the problem! I'm wondering if I should report this as a bug to SUN Microsystems? All it was, was a syntax error generated by:

<jsp:params>
<jsp:param name="action" value="<%=AppletAction%>" />
<jsp:param name="redirect" value="<%=AppletRedirect%>" />
<jsp:param name="CompanyID" value="<%=companyID%>" />
<jsp:param name="AdministratorID" value="" />
<jsp:param name="RecordLimit" value="40" />
<jsp:param name="OnErrorPage" value="<%=AppletError%>" />
</jsp:params>
<jsp:fallback>
<B>Error: Unable to load Applet.<br>This page requires the Java Virtual Machine version 1.5 or greater to run.
</jsp:fallback>
</jsp:plugin>

That code creates the following code for the client side:

<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" width="400" height="300" codebase="http://java.sun.com/products/plugin/1.2.2/jinstall-1_2_2-win.cab#Version=1,2,2,0">
<PARAM name="java_code" value="mvcs.TableForm.class">
<PARAM name="java_codebase" value=".">

<PARAM name="type" value="application/x-java-applet;">
<PARAM name="action" value="http://localhost:8080/scholastic/AddStudentTableData">
<PARAM name="redirect" value="http://localhost:8080/scholastic/admin/SuccessfulTransaction.jsp">
<PARAM name="CompanyID" value="4">
<PARAM name="AdministratorID" value="">
<PARAM name="RecordLimit" value="40">
<PARAM name="OnErrorPage" value="http://localhost:8080/scholastic/admin/AdminMainMenu.jsp">
<COMMENT>
<EMBED type="application/x-java-applet;" width="400" height="300" pluginspage="http://java.sun.com/products/plugin/" java_code="mvcs.TableForm.class" java_codebase="." action="http://localhost:8080/scholastic/AddStudentTableData" redirect="http://localhost:8080/scholastic/admin/SuccessfulTransaction.jsp" CompanyID="4" AdministratorID="" RecordLimit="40" OnErrorPage="http://localhost:8080/scholastic/admin/AdminMainMenu.jsp"/>
<NOEMBED>

<B>Error: Unable to load Applet.<br>This page requires the Java Virtual Machine version 1.5 or greater to run.

</NOEMBED>
</COMMENT>
</OBJECT>

There's a lot going on there, but basically Netscape only cares what is inside the <EMBED> tag. The rest is for IE to decipher. The line that contains the bug is: type="application/x-java-applet;". IE doesn't seem to mind this little string but Netscape does! The problem with it is the semi-colon! Netscape doesn't like it! I removed it out of desperation after trying numerous things, then WHALAA!!! The applet loaded!

I'm feeling kinda proud now! Maybe I will report this as a bug. Don't come across too many of them.

Alan

[ October 26, 2005: Message edited by: Alan Shiers ]
[ October 26, 2005: Message edited by: Alan Shiers ]
reply
    Bookmark Topic Watch Topic
  • New Topic