United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6648488 Add JavaScript syntax for per-applet class and static method access
JDK-6648488 : Add JavaScript syntax for per-applet class and static method access

Details
Type:
Enhancement
Submit Date:
2008-01-09
Status:
Closed
Updated Date:
2010-09-08
Project Name:
JDK
Resolved Date:
2008-06-13
Component:
deploy
OS:
generic
Sub-Component:
plugin
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
6u10
Fixed Versions:
6u10 (b11)

Related Reports
Backport:
Relates:

Sub Tasks

Description
A request has been made on the java.net forum for access from JavaScript to static methods of an applet's classes, not just to the global Java namespace. This should be implementable in the new plug-in with syntax like

  myApplet.Packages.com.foo.Bar.baz()

assuming there is an applet on the page whose ID is "myApplet".

See http://forums.java.net/jive/thread.jspa?threadID=35072&tstart=0 for the original discussion.

                                    

Comments
SUGGESTED FIX

http://sa.sfbay.sun.com/projects/deployment_data/6u10/6648488.0
testcase: http://j2se.east.sun.com/deployment/www/tests/1.6.0_10/6648488
                                     
2008-01-10
EVALUATION

Added support for the "Packages" keyword against the applet object,
providing the necessary scoping to allow access to user-level classes
including static fields, static methods and instantiation of new
objects. The syntax looks like:

   applet1.Packages.com.company1.HelperClass.staticField

or

   new applet1.Packages.com.company1.HelperClass()

where "applet1" is the ID of the applet defined on the web page.

The changes needed were to keep track of which object is the top-level
object (i.e., the applet) exported to the web browser, and to inject
support for the magic "Packages" keyword against only that object,
returning a new top-level JavaNameSpace object for that field fetch.
All of the other necessary infrastructure was already in place.

Verified the new functionality both in IE and Firefox 3.
                                     
2008-01-10



Hardware and Software, Engineered to Work Together