Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Flash Remoting / March 2004



Tip: Looking for answers? Try searching our database.

reusing servlets

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
UTD - 23 Feb 2004 22:30 GMT
Hello,

I have a bunch of servlets already written. Now I have to use them with new
flash pages. I am using Flash Remoting with Flash MX 2004 and Jrun4. I was able
to invoke the servlet from the Flash. But how can I pass the parameters, the
servlet is expecting. For example I have a Logon.java servlet . It is expecting
two parameters 'userid' and 'password' in the HttpServletRequest.  The action
script I am using is as follows:

#include "NetServices.as"

NetServices.setDefaultGatewayUrl("http://localhost:8101/flashservices/gateway");
gatewayConnection = NetServices.createGatewayConnection();
servletService = gatewayConnection.getService("compass", this);

function logon_Result(result)
{
    _root.output.text = result;
}

function logon_Status( error )
{
    _root.output.text = error;
}

In the login button actions I have placed the following code.
on(click) {
    _root.servletService.logon();
}

It is invoking the logon  servlet  on the server. but I have to pass the
parameters and handle the results which it returns.

Thanks & Regards.
glpete - 25 Feb 2004 16:23 GMT
You invoke your servlet like any other remoting object:

servletService.ServletNameGoesHere(  userID, password );

Except you use your servlet's name as the method name.

On the server side, your servlet's service method is invoked. You extract the
FLASH.PARAMs attribute:

List params = (List)request.getAttribute("FLASH.PARAMS");

Your userid should be the first parameter (params[0]) and the password the
second (params[1]).

There may be other ways to do this, but this way is working for me.
UTD - 01 Mar 2004 16:34 GMT
Thanks for the solution. But the main thing here is we have to change the
servlet to read the parameters. I don't have any authorisation on changing the
servlet. Is there any way that I can reuse the servlets as it is?

Thanks & Regards.
glpete - 01 Mar 2004 16:45 GMT
Can you introduce a new servlet? You can have your new one extend the current one. Your new servlet would have a service method. The get and post method would inherit from the old one.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.