20.13. Calling Java or JSP Functions from Flash
You want to invoke J2EE service functions using Flash Remoting.
Use public Java class methods. Alternatively, use servlets/JSPs that have been modified to work with Flash Remoting.
Although Flash Remoting for J2EE enables you to invoke public methods of Java classes or servlets/JSPs, invoking Jave class methods is the preferable option. You can invoke any public method of a Java class without having to modify the Java code at all. This is an obvious advantage. To access the methods of a Java class from Flash Remoting, you should create an ActionScript service object that maps to the fully qualified Java class name:
// Create a service that maps to the
Bookclass in the
oreilly.ascbpackage. myService = myConnection.getService("oreilly.ascb.Book");
If you must use servlets/JSPs instead of invoking Java class methods,
you need to modify the servlet/JSP code for it to work properly with
Flash Remoting. Values are passed to and from the servlet/JSP by way
of attributes of the
request object. Parameters
are passed from Flash to the servlet/JSP using the attribute named
FLASH.PARAMS. You can retrieve the attribute value
getAttribute( ) method of the
request object. For example:
Object myFlashParams = request.getAttribute("FLASH.PARAMS");
The value of the
FLASH.PARAMS attribute is a
List object. However, if you want the servlet/JSP to be accessible from a web browser as well as from Flash Remoting, you should ...