Results 1 to 5 of 5
- 11-28-2009, 08:24 AM #1
Member
- Join Date
- Nov 2009
- Posts
- 4
- Rep Power
- 0
Sending Response From ServletContextListener
Hey Guys I am using a ServletContextListener in my web application. I am able to create listener but the problem is i am not able recieve any request nor able to send any response from listener to any other servlet or browser.
Can anyone please help me out
Thanx in advance
- 11-28-2009, 04:40 PM #2
the servlet [initial] context listener is invoked when the container stars up and shuts down the application, you can't get to it from a servlet such as during handling a request, and the context listener cannot interact with servlets.
session listeners are similar,though you do have the http session handle there, so could set up session attributes in the listener when session is created and the down stream execution of a servlet could extract that attribute.
but not entirely sure what it is you are wanting to do.
- 12-02-2009, 05:30 PM #3
Member
- Join Date
- Nov 2009
- Posts
- 4
- Rep Power
- 0
Hi Travishein,
Thanks for ur precious response.
Actually my requirement is to create a reminder. A user will set the date and time and i want to popup the window at that perticular date and time.
So i was trying to start the thread using ServletContextListner which is going to check the date and time,but since listner cannot interact with servlets i am unable to do the above.
Do you have any other idea for my requirement.
Thanks In Advance
- 12-02-2009, 05:37 PM #4
i guess to have a reminder popped up automatically, such as if the page is loaded already and the user is not clicking anything, this will need to be some kind of ajax based invocation of a server side resource to "check for notifications", where if there is a notification, one is rendered (probably through some kind of dhtml or javascript then).
I would say to start off, have a server side component , like in the servlet that renders the page, like an include, check the (thing that knows if there is a reminder to be displayed), and if so, to stuff the reminder in, such as render it out into the output html if this is a JSP page.
Like, getting the mechanism of displaying the reminders to the user by the simple invoke the request and the response shows the reminder if any , is a good start.. Then work on the figuring out how to make this invoked asychronously using an ajax framework.
if you aren't using one yet, the yahoo user interface (YUI) javascript library is pretty well documented and has examples for typical use. then you would need to make a server side reminder servlet that services requests for checking for reminders for a given user.
- 12-03-2009, 08:59 AM #5
Member
- Join Date
- Nov 2009
- Posts
- 4
- Rep Power
- 0
Similar Threads
-
response.setContentType
By bbq in forum Java ServletReplies: 3Last Post: 01-17-2012, 05:37 PM -
Try catch response
By Reiyn in forum New To JavaReplies: 1Last Post: 03-30-2009, 08:30 PM -
response.sendRedirect(url)
By mutuah in forum Advanced JavaReplies: 2Last Post: 08-07-2007, 01:56 PM -
Velocity / XML response
By sabatier in forum XMLReplies: 0Last Post: 07-24-2007, 01:13 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks