Forums Register Login
Datetime taglib
I downloaded the jakarta datetime taglib, and am able to use it well enough.
My problem is, I want to be able to show what the current date is for the client. However, since the server is in England, it keeps showing the date for the server. Is there a way using this taglib to do this (hopefully someone has used it before), or any other way to use jsp's to show the client's date, not the vm's running on the server?
First, I have no idea.
JSP's are server side components, as you might agree with me. I would assume
1. you probably must use some kinda Javascript for this.
2. A cookie/header maybe but not the accurate client time. This would probably give you request date and time, maybe.
3. Not sure how, but a lot of webpages do this.
Never tried any of these, but that would be my first guess.
Interesting problem, though.
- satya
This really has nothing to do with server-side vs. client-side processing. Most date/time facilities make allowances for different locales and timezones. I haven't had a chance to check out the taglibs yet, but I can't help but think that locales and timezones must be accounted for in some way. Check the docs for the taglib for these topics.
If this is the case, obviously the client must inform the server-side software of the appropriate locale and timezone to use. But there's no reason that server-side software cannot handle any locale and timezone.
It does have options for setting locale and timezone, which I tried utilizing. Locale is used for formatting and parsing of a date String, and from what I read of the timezone tag, you would use this to gather a list of available timezones, and then the client or whoever would choose the one appropriate to them.
What I'm trying to figure out is how does the client automatically tell the server what timezone or locale they are in, so that the date reflects that. Making a drop down list for them to choose from is easy enough, it's the automatically configuring at page start up that is a pain.
Whether I use the taglib from jakarta or not is not an issue, I'd like to find any way a JSP can do this.
Locale's are available on the Request Header.
But remember, I can be in Japan and use a German/Chinese locale. So I don't think locale is what you want.
Check the getDatHeader() method of the HttpServletRequest interface. See what it returns.
- satya
Been there. Done that. Went back for more. But this time, I took this tiny ad with me:
Programmatically Create PDF Using Free Spire.PDF with Java

This thread has been viewed 1106 times.

All times above are in ranch (not your local) time.
The current ranch time is
Jan 20, 2019 06:12:18.