User Guide
Table Of Contents
- Contents
- About Flash Remoting
- Getting Started
- Using Flash Remoting ActionScript
- Using the RemotingConnector component (Flash Professional only)
- Using Flash Remoting Data in ActionScript
- About Flash Remoting and data types
- Understanding Action Message Format
- Converting from ActionScript to application server data types
- Converting from application server data types to ActionScript
- ColdFusion to ActionScript data conversion issues
- About working with objects
- About working with RecordSet objects
- About working with XML
- The NetConnection Debugger
- Using Flash Remoting with ColdFusion MX
- Using Flash Remoting for Java
- About Flash Remoting for Java
- Calling Java classes or JavaBeans from ActionScript
- Calling Enterprise JavaBeans (EJBs) from Flash
- Calling servlets and JSPs from Flash
- Calling JMX MBeans from Flash (JRun only)
- Calling server-side ActionScript from Flash (JRun only)
- Handling function results in ActionScript
- Using Flash Remoting with JRun security
- Passing XML objects between Flash and Java
- Viewing Flash Remoting log entries
- Using Flash Remoting for Microsoft .NET
- Flash Remoting for Microsoft .NET
- Calling ASP.NET pages from Flash
- Making an ASP.NET page available to Flash Remoting
- Getting a reference to an ASPX-based service in ActionScript
- Invoking ASPX pages in ActionScript
- Using the Flash Remoting custom server control in ASPX pages
- Using the Flash Remoting namespace in code-behind files
- Using ASP.NET state management with Flash Remoting
- Using ASP.NET exception handling
- Using ADO.NET objects with Flash Remoting
- Displaying a RecordSet object in Flash with ActionScript
- Calling web services from Flash
- Calling ASP.NET assemblies from Flash
- Viewing Flash Remoting log entries
- Using NetServices and Connection Classes
- Index

Calling servlets and JSPs from Flash 133
Calling a servlet or JSP
To call a servlet or a JSP defined as a servlet from ActionScript, use the servlet name specified in
the web application’s web.xml deployment descriptor file as an ActionScript function name. For
example, the servlet name is MyServlet in the following example:
function go_Clicked()
{
var pc:mx.remoting.PendingCall = servletService.MyServlet();
pc.responder = new RelayResponder( this, "MyServlet_Result",
"onCategoryFault" );
// etc.
}
The web.xml file contains the following servlet definition:
<servlet>
<servlet-name>MyServlet</servlet-name>
<display-name>MyServlet</display-name>
<description>Simple text servlet</description>
<servlet-class>MyServlet</servlet-class>
</servlet>
Note: On Servlet 2.3-compliant application servers, you can define a JSP as a servlet by specifying a
JSP filename in a JSP-file element, rather than a servlet class in a servlet-class element.
Request arguments sent from Flash as parameters of the ServletName() function are available
from the Request scope as the parameter
"FLASH.PARAMS". You can return results to Flash using
the request parameter
"FLASH.RESULT", as shown in the following servlet:
import javax.servlet.*;
import java.io.IOException;
import java.util.List;
public class MyServlet implements Servlet
{
private String message = null;
public void init(ServletConfig config) throws ServletException
{
message = "Hello from MyServlet";
}
public void service(ServletRequest request, ServletResponse response)
throws ServletException, IOException
{
// The args could be used here too...
/*
Object o = request.getAttribute("FLASH.PARAMS");
if (o instanceof List)
{
List args = (List)o;
}
Object arg0 = args.get(0);
Object arg1 = args.get(1);
*/
request.setAttribute("FLASH.RESULT", message);