Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Identitfying images using Timestamp  RSS feed

 
Gaurav Pawar
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I need JSP code to identify an image using its time-stamp.

Something like:



I got this from one of the previous posts, I tried it but is not working. What could be wrong?

The reason why i need to identify the images using a timestamp is that for every client request my server is generating a different image each time as "myimage.png".

However, IE does not refresh and somehow shows the previously generated image. I want code that specifically identifies an image by its name and some other additional property.

Thank you.
Gaurav.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66187
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Gaurav Pawar:
I got this from one of the previous posts, I tried it but is not working. What could be wrong?


Did you create a custom tag named timestamp and a tag library mapped to bps? If not, then of course it won't work.

If you don't want to use a custom tag, something like the following might work (warning, not tested):


[ April 04, 2007: Message edited by: Bear Bibeault ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here:
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The point, in the other post, was not to identify an image by it's timestamp.
The point was to make sure the URL for the image was unique every time by adding a unique querystring variable to it.

Everything after the '?' mark in a url is considered the querystring; which is a series of name/value pairs separated with an '=' character.
Unless your app is looking for a request parameter named "ts" it's going to ignore everything after the '?' and only pay attention to the requested resource: "myImage.jpg".

All the browser knows is that it's never made a request with that exact same url before so it won't try to use a cached version.


Becuase I would never put a scriptlet or scriptlet expression in a production JSP (that other moderator would not approve), if I were doing something like this, I would move the code to get the timestamp into a custom tag with a name like <bps:timestamp />

Does this make sense?
-BPSouther
[ April 05, 2007: Message edited by: Ben Souther ]
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!