File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes EJBs and Applets Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply Bookmark "EJBs and Applets" Watch "EJBs and Applets" New topic
Author

EJBs and Applets

Rik Sweeney
Ranch Hand

Joined: Sep 04, 2001
Posts: 36
I need to communicate with a database in my Applet program and am at the moment sending the data to a servlet via an IO Stream.
Instead of using an IO Stream to send data to a servlet, performing a task, opening a new stream and sending the data back to the applet, is it possible to use an EJB to perform this task for me?
i.e. Can I create an EJB in the applet to avoid me having to use IO Streams to send data?
Thanks
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 14491
    
    7

Actually, it's not good practice for applets to do either database I/O or invoke EJBs. Both processes tend to fail because of intervening firewallss blocking the requests (plus the applet sandbox forbids jdbc in unsigned applets).
The more effective way is to have the applet invoke JSPs and/or servlets to do the work and return results to the client. They can do all the EJB and jdbc access they like.


Customer surveys are for companies who didn't pay proper attention to begin with.
Steve Knight
Greenhorn

Joined: Jun 19, 2001
Posts: 11
I think an applet talking to a session facade bean which then interacts with entity beans is an acceptable approach. So long as firewalls are not a concern. You may have to change the policy file on the client to make this work, however.
So, it probably makes sense if you are deploying on an intranet. But, if firewalls are a concern then use either servlets or even webservices in between the applet and EJBs. I am considering the webservice approach for a future project.
Steve
Gaurav Chikara
Ranch Hand

Joined: Jun 09, 2000
Posts: 410
we can send the data from applet in the form of
datapacket which implements hashtable()
this datapacket will goto a servlet
and that servlet will do the database related work and return the result in the form of a vector


SCJP,SCWCD,SCBCD<br />If Opportunity doesn't knock then build the door
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: EJBs and Applets
 
Similar Threads
passing custom object from jsp to applet
what is the maximum size of a data a servlet can send per stream?
simple questions
The best approch on applet to server communication
Applet doesn't establish JDBC connection