Dates, yuck. Every time I get into dealing with a lot of dates from different datasources, it becomes a huge hairball.
Here's one trick that can make it a little easier.
You can force the default timezone used for an app server to be different then the timezone of the server it's running on, so at least that will remain consistant if your various servers are not all set the same. And it's quite simple.
First, create a simple ServletContextListener like so...
Second, initiate the context listener from your web.xml file...
That's it, your app will now run with the default timezone you set no matter what server it's running on, or what the timezone is on that server.
Unfortunately the log files it produces will still be in the servers timezone, which is annoying. Anyone got an easy fix for that?
Tuesday, February 12, 2013
Monday, January 28, 2013
Opening a link in a modal or new window
For a web application I'm working on we have a need to open a page to show more details for a specific report.
Opening the page in a modal keeps the coherency of the application intact and provides a good look and feel, but there are times when users will want to open several of the modals at once and be able to reference them all without needing to close one before opening the next. Opening to a new window or tab makes more sense at these times.
To accomplish this I setup a standard HTML link so the users can right click and open the link in a new tab or window, but I also used JQuery to highjack the regular click action to open the link in a modal on the existing page.
Lets look at how to get this working:
1. Here's the full html for the demo page, you'll notice I'm using JQuery, and the JQuery UI package for the modal...
Opening the page in a modal keeps the coherency of the application intact and provides a good look and feel, but there are times when users will want to open several of the modals at once and be able to reference them all without needing to close one before opening the next. Opening to a new window or tab makes more sense at these times.
To accomplish this I setup a standard HTML link so the users can right click and open the link in a new tab or window, but I also used JQuery to highjack the regular click action to open the link in a modal on the existing page.
Lets look at how to get this working:
1. Here's the full html for the demo page, you'll notice I'm using JQuery, and the JQuery UI package for the modal...
2. You will need the following css setup so the modal isn't visible right away, and to set the modal size. I also get rid of the ugly border around the iframe.
3. Here's the jquery magic to highjack the link and make it open in a modal for a standard left click. We'll attach this event handler to all links with the modal-link class, and the modal will open the url from the links href attribute.
Subscribe to:
Posts (Atom)