• Post Reply Bookmark Topic Watch Topic
  • New Topic

EJBs and Applets

 
Rik Sweeney
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 18408
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Steve Knight
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!