Meaningless Drivel is fun!*
The moose likes Servlets and the fly likes Very urg help me Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Very urg help me" Watch "Very urg help me" New topic
Author

Very urg help me

vijay gates
Greenhorn

Joined: Mar 22, 2010
Posts: 2
I want to display a pop up dialog box whenever database is updated,database should display a pop up msg or through java prgm anyway but pop up dialog box displayed for the system which updates...............can any1 please help me out......???


Thankz in advance..
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

You're very urg? Not sure what that is, but it sounds unpleasant. Have you spoken to a doctor? If not you might benefit from reading this.

You've posted this question in the Servlets forum so I'll assume "java prgm" stands for a web application, in which case this can't be done. HTTP is a request driven protocol and will not support data being pushed from the server. You can simulate the behaviour by polling the server from a client (possibly using AJAX so it appears less obtrusive) but that's a close as you'll get.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Please UseAMeaningfulSubjectLine when posting. Explaining your question or remark briefly on the subject line allows us to know what we are getting into, and if we will be able to help. Taking the time to compose a useful subject line shows that you care enough about your question to ShowSomeEffort when asking it here.

Also, please read EaseUp.
Sriram Sharma
Ranch Hand

Joined: Apr 12, 2006
Posts: 97
There are many assumptions that I am taking here...
The DAO file will get the reply back from Database once the update or insert of delete is done in DB.
Based on the value that you get back, you can set some value and return the value for success or something that way and from the action class you can manipulate appropriately.
Once in the JSP, you can use script to create an alert.

Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Sriram Sharma wrote:There are many assumptions that I am taking here...
The DAO file will get the reply back from Database once the update or insert of delete is done in DB.
Based on the value that you get back, you can set some value and return the value for success or something that way and from the action class you can manipulate appropriately.
Once in the JSP, you can use script to create an alert.



I'm not sure I follow. OK, if a specific request from a client is made to update the database the client can be informed about any result from that database operation. But how does an update in the database get to the DAO layer if its not made by that client? Are you suggesting calling Java Code from a trigger or something? And once the DAO layer has the response how does it find which clients are using the application?

Sriram Sharma
Ranch Hand

Joined: Apr 12, 2006
Posts: 97
Q: But how does an update in the database get to the DAO layer if its not made by that client?
A: In DAO layer, I assume we do something like... "int insertedRow = pstmt.executeUpdate();"
So, once the insert/update is done, the appropriate int value comes out which can be used to identify if the insert is successful or not - also I assume the relevant try-catch-finally are there.
Sorry that I did not think of the scenario where DB update is done by some other client. In this case also an event can be fired once the update is done and all the clients can be listening to the event and some operation be performed for the listened event.

Q: Once the DAO layer has the response how does it find which clients are using the application?
A: I was thinking about one-one scenario like having the client details (client credentials like uerid/pass, some unique key, ip address) in some object with which we can end up to the same client who started the operation??? - Something like a railway/airline reservation where a user gets a confirmation message once the reservation is done in the DB.
Probably.....
We can have the list of online users and send out an intimation to all those users.

Now I have got one question... Is it possible to call a java code from a trigger?
I would love to know about it please...

Regards,
Sriram
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Sriram Sharma wrote:
Q: Once the DAO layer has the response how does it find which clients are using the application?
A: I was thinking about one-one scenario like having the client details (client credentials like uerid/pass, some unique key, ip address) in some object with which we can end up to the same client who started the operation??? - Something like a railway/airline reservation where a user gets a confirmation message once the reservation is done in the DB.

Probably.....
We can have the list of online users and send out an intimation to all those users.


That works fine when a particular client makes a request and the server sends a response. But how do you handle the situation where ten clients are using the application (though perhaps not actively sending requests), and only one of them is performing the operation you mention? How do we alert the other nine clients to the change of state? HTTP is a request driven technology; it is inherently "pull", not "push".

Sriram Sharma wrote:
Now I have got one question... Is it possible to call a java code from a trigger?
I would love to know about it please...

Yes. Some databases support Java, others support calls to the OS from a trigger. Check your database docs.
Ggaurav Gupta
Greenhorn

Joined: Mar 26, 2010
Posts: 9
Hi,
look in to the calling java function from oracle and look in to the DWR and Reverse Ajax that will solve your problem.
By DWR and Reverse Ajax you can call the Javascript functions from java code.
invoke that java code from oracle
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Whenever I hear about people using Reverse AJAX, I wonder why they didn't just use a proper fat client technology (Applets, ActiveX etc.). Reverse AJAX is a mechanism to subvert how a web application behaves to get it to appear to behave like a fat client. If you really need such behaviour why rely on such hooky mechamisms to do it?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Very urg help me
 
Similar Threads
When two jsp used for same page, problem to display time
Popping up MS Word in my application
Javascript funtion for open dialog box
JSP out put to printer
JDialogBox