Forums Register Login

Calling a Servlet in Flash

+Pie Number of slices to send: Send
I have an HTML website that utilizes Servlets. I want to recreate the site using Flash. Is there a way to embed or call a servlet that queries a MS Access database in a Flash developed site? If anyone can direct me to a proper website or assist me in this I would be very appreciative.
[ April 18, 2002: Message edited by: Peter Cuba ]
[ April 22, 2002: Message edited by: Peter Cuba ]
+Pie Number of slices to send: Send
You need to include more specifics. Where does the database live (client or server)? Are you trying to dynamically access the server data from the client?
+Pie Number of slices to send: Send
Hi Peter,
You have to use action script's loadVariables() command. It takes in three parameters, the third optional. Here is a sample:

Have something in your movie trigger this, like a on (release) for a button.
As for you servlet, it needs to write out a plain text response for the flash to take the information in. For example, let's say we've logged in a user and are fetching their first and last name. Your servlet should write out:

Basically, &varName=value. Flash will read this in, and now your movie will have two variables, called firstname and lastname, that you can use in your movie.
I haven't tried this out with a servlet yet, but it should work no problem. I've done this with php and it works no problem. There is a good book called PHP for Flash. The book has a
web site where you can download all the source code and flash files.
If you have any other questions, just post here and I'll try to help as best I can
HTH,
/rick
P.S. Oh yeah. I don't know if you use J2EE, but Flash 6 has a special gateway to work with J2EE app servers. The only problem is that it only works with JRun (talk about vendor lock-in)
+Pie Number of slices to send: Send
Hi Peter, a quick search on Macromedia's Flash support site gives a link to this tech note:
http://www.macromedia.com/support/flash/ts/documents/java_get.htm
Here's a link to a tutorial for using Servlets with Flash. I've just started looking into this option myself, haven't done the tutorial yet though. http://www.virtual-fx.net/tutorials/html/flashjavaservlets.html
I'd be very interested to hear how you do with this.
Pauline
[ April 23, 2002: Message edited by: Pauline McNamara ]
+Pie Number of slices to send: Send
 

Originally posted by rick salsa:
As for you servlet, it needs to write out a plain text response for the flash to take the information in. For example, let's say we've logged in a user and are fetching their first and last name. Your servlet should write out:

Basically, &varName=value. Flash will read this in, and now your movie will have two variables, called firstname and lastname, that you can use in your movie.


Just as a side note, this format is called URLEncoded format. You can pass parameters in this was to Flash just as you'd pass them to a CGI script. I use this exact technique to read a file into Flash for "context-sensitive" links at my website.
When you embed you .swf file, just add a '?' and then the parameter list, like this:

Of course, if you'd rather hide the parameters a little better, you could write them to a file and simply pass the file name to the Flash application.
I hope you find this useful,
Corey
+Pie Number of slices to send: Send
There was a session at JavaOne given by a guy from Macromedia about Flash and J2EE -- you can check you the slides online, you just need to register first (if you haven't already)
Building Next-Generation Web Application Interfaces for the JavaTM 2 Platform, Enterprise Edition (J2EETM)
You can actually watch the session by purchasing a pass through the Java Learning Center
[ April 23, 2002: Message edited by: Jessica Sant ]
+Pie Number of slices to send: Send
 

Originally posted by rick salsa:
Hi Peter,
You have to use action script's loadVariables() command. It takes in three parameters, the third optional. Here is a sample:

Have something in your movie trigger this, like a on (release) for a button.
As for you servlet, it needs to write out a plain text response for the flash to take the information in. For example, let's say we've logged in a user and are fetching their first and last name. Your servlet should write out:

Basically, &varName=value. Flash will read this in, and now your movie will have two variables, called firstname and lastname, that you can use in your movie.
I haven't tried this out with a servlet yet, but it should work no problem. I've done this with php and it works no problem. There is a good book called PHP for Flash. The book has a
web site where you can download all the source code and flash files.
If you have any other questions, just post here and I'll try to help as best I can
HTH,
/rick
P.S. Oh yeah. I don't know if you use J2EE, but Flash 6 has a special gateway to work with J2EE app servers. The only problem is that it only works with JRun (talk about vendor lock-in)

 
+Pie Number of slices to send: Send
 

Originally posted by Pauline McNamara:
Hi Peter, a quick search on Macromedia's Flash support site gives a link to this tech note:
http://www.macromedia.com/support/flash/ts/documents/java_get.htm
Here's a link to a tutorial for using Servlets with Flash. I've just started looking into this option myself, haven't done the tutorial yet though. http://www.virtual-fx.net/tutorials/html/flashjavaservlets.html
I'd be very interested to hear how you do with this.
Pauline
[ April 23, 2002: Message edited by: Pauline McNamara ]


Thanks Pauline. I downloaded that tutorial. It looks like valuable info that might solve my problem. I will let you know about my progress.
Peter
+Pie Number of slices to send: Send
Thanks everyone for your input. I am sure you will be hearing from me soon again.
Peter
[ April 24, 2002: Message edited by: Peter Cuba ]
+Pie Number of slices to send: Send
 

Originally posted by rick salsa:
P.S. Oh yeah. I don't know if you use J2EE, but Flash 6 has a special gateway to work with J2EE app servers. The only problem is that it only works with JRun (talk about vendor lock-in)


I'm happy to say that this is not so - Flash remoting will work with other app servers as well. I can't give you a specific list, but watch for announcements.
+Pie Number of slices to send: Send
 

Originally posted by Karl Moss:

I'm happy to say that this is not so - Flash remoting will work with other app servers as well. I can't give you a specific list, but watch for announcements.


Hmmm This must be new? I'm on the JRun beta testing team, and they mentioned that this would only work with JRun? I haven't been there in a bit, so maybe this is new?? If that's the case, then it is great news
/rick
[ April 25, 2002: Message edited by: rick salsa ]
Space pants. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1761 times.
Similar Threads
orion server, servelet chaining
HTTP(Servlet)-RMI-JDBC
Put bookSeat at server side or client side???
lock() and bookSeats() - - - - - - waiting for response
How to create a Database Name
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 09:01:38.