• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSP & JMS

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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,
 
Vidya Moorthy
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic