Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to display image based on the time ?  RSS feed

 
Bhoomika Bathla
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working on a web portal.I need to display a chat link on the page.The specifications are as follows :-
1. Chat link should be visible to specific user -- already defined in a table.
2. If chat link is visible then there are two cases in it.Firstly if timings are between 8 am to 6pm then the chat open image should be visible,else chat close image.

I am using servlets and jsp.

How do i proceed with the solution.What flow do i need to follow to implement this??

Thanks
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37261
519
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this only one page? If so, just use an if statement in the servlet of c:if in the JSP. If it is on multiple pages or you need to protect the chat pages themselves with the same logic, I would use a servlet filter - that way all the "is chat open" logic can be in the same place.
 
Bhoomika Bathla
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes this is in one page only.But it may be possible that user is using the link and suddenly the clock stuck 6 so after 6 the link should not be visible.User needs to refresh the page to do so.One constraint is that I cannot use Ajax.How should i keep checking the time and refresh the page accordingly??
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66208
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't need Ajax to change an image. Just change it's src attribute. You'll need to handle all this in JavaScript of course.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!