• 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

Simple messaging for a j2ee application MVC

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,
I have a web application ( DBBeans --Servlet --JSP) .
I need to incorporate a functionality such that:
if the admin needs to send out a message to the app-logged in users , for example : "Application will shutdown in 10 mins. Please save your work and logout of the app: Message8" and can control the number of times this message is shown to a any users, how can I do that in the app without using a full blown messaging service (JMS, MQSeries) .
For now, I have a property file where I can put a string (example:Message8) which the app will pick up when it loads any of the jsp and show it in an alert box, but I have no way to track/control as to how many times a user should see the message !
Possibly I can modify the code in the controller (servlet) and keep track in a session object but thats still possibly an old way of doing things.
I was thinking of some module like log4j that I could plug into the app for the messaging .
Any suggestion ?
Again , many thanks .
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems to me that the ideal place to track whether a useer has seen a message is in their session.
How about you create a new "message display" object which is placed in every session as it is created, and has a simple method (e.g. show()) which shows a message and increments a count. When the count hist your maximum, or if there is no message, it just shows nothing.
You could either put a call to this "show" method at the top of every JSP, or write a filter which catches every request and does the same thing.
Does that sound reasonable?
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually a MUCH better place to put the message (but not the read flag -- see Frank's suggestion) than in a property file is in a ServletContext attribute (the application scope in JSP) which was designed to hold this kind of global information...
Kyle
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic