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?
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.
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 ]
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.