users@glassfish.java.net

Re: How to invoke Client Callback Handler from EJB3 Session Bean

From: <glassfish_at_javadesktop.org>
Date: Sat, 17 May 2008 06:55:51 PDT

> Everything is clear except how the Server side (EJB)
> will pass the
> parameters to the Client side.

Well, you surely wouldn't want the server randomly calling the client and popping up dialogs whenever it felt like it in this scenario. Bear in mind I know exactly what you're trying to do, and Tim is pointing you in the right direction.

You still want to do this as a return value from the server; trust me.

Think of it this way. You want extra information [i]as a reaction to[/i] the user entering too [i]little[/i] information. So the user supplies an ID, but didn't supply, say, color. Because of that you want the server to [i]return[/i] your client enough information so that it can ask your user for more. You don't want the server to push a dialog in the user's face--that kind of interaction should always be up to the client.

So here's your client pseudocode:
[code]
Result result = server.addProduct(incompleteInformation);
if (result != null) {
  RequiredInformation infoUserNeedsToSupply = result.getRequiredInformation();
  if (infoUserNeedsToSupply != null) {
    // TODO: build JDialog; get information out of infoUserNeedsToSupply; show dialog
    // TODO: when user closes dialog get user info
    // TODO: re-call server method with new information
  }
}
[/code]

Best,
Laird
[Message sent by forum member 'ljnelson' (ljnelson)]

http://forums.java.net/jive/thread.jspa?messageID=274996