This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes JSP & JMS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "JSP & JMS" Watch "JSP & JMS" New topic
Author

JSP & JMS

Vidya Moorthy
Ranch Hand

Joined: Nov 13, 2003
Posts: 57
I am new to JMS and JSP. Please excuse my ignorance
What I am trying to do is whenever there is any changes in the db, I want the latest info to be sent to my web client without it requesting for it. If there is a change in the db again, it has to be sent to the queue which will send a message to the jsp page and the the latest DB values have to be posted to the jsp page without a refresh? Please help me.
How to set the values in application context in the receiver java program. None of the implicit objects of jsp page will be available in java programs. Am I overlooking something here?
Amit M Tank
Ranch Hand

Joined: Mar 28, 2004
Posts: 257
remember that JSP is just a servlet. when the content are displayed to the client from the JSP it is represented as an output of the JSP as HTML. So if you want that your content could get refreshed in the client side(HTML page) when there is a DB update then you have to use AJAX and poll the value you want to display on the client side in a timely manner.

thanks,


Amit Tank
Linked In
Vidya Moorthy
Ranch Hand

Joined: Nov 13, 2003
Posts: 57
Hi Amit
Thanks a lot! I have never used Ajax before. Would it be possible to use ServletContext attribute for the query of the database (set it in application context)and ServletContextAttributeListener for the change in the database? Then set the queueReceiver to setMessageListener on the ServletContextAttributeListener.
Thanks in advance
Vidya
[ June 23, 2008: Message edited by: Vidya Moorthy ]
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


What I am trying to do is whenever there is any changes in the db, I want the latest info to be sent to my web client without it requesting for it

One of the most importent things to remember about JSP/Servlets is they are request driven and this is unchangeable. You can't push data from the server to a client; HTTP was never designed to support this. Your only choice is to poll the server in some way (if you intend to use HTTP). As Amit M Tank suggests, AJAX is a technique you might use to make it appear that data is being pushed to the client.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP & JMS
 
Similar Threads
Properties in InitialContext for SimpleQueueReceiver.java, MQ5.3 server remotely
P2P using WSAD's embedded JMS- Naming Exception
JMS - Name QueueConnectionFactory is not bound in this Context
P2P using WSAD's embedded JMS- Naming Exception
New To JMS