Monday November 18, 2002
JSTL and Cookies Something I learned today about JSTL - you can use {cookie.cookieName.value}* to get the String value of a cookie. Cool stuff, I found it by looking in the JSTL In Action book I bought about a month ago. BTW, if you're going to buy the book, you can get if for $12 cheaper from Amazon.
Here's an example of how I used this new-found syntax in my project.
<c:if test="{cookie.style.value == 'widescreen'}">
body {
background-image: url(/images/bg-wide.gif);
}
</c:if>*
I also implemented the
stylesheet switcher from A List Apart today. Very cool stuff - although I did have to add an extra line in the setActiveStyleSheet function to create a cookie for title. The following code block is supposed to do this for me, but didn't seem to work on XP with the latest browsers.
window.onunload = function(e) {
var title = getActiveStyleSheet();
createCookie("style", title, 365);
}
Oh well, at least I got it to work and learned some more JSTL in the process!
* I tried using the real syntax with a preceeding $, but that didn't work too well, and Velocity puked with:
[VELOCITY ERROR: parsing weblog entry] org.apache.velocity.exception.ParseErrorException: Encountered ".cookieName.value}
Any ideas why? It brings up another question I've been meaning to ask - is it possible to use Velocity syntax that's similar to JSP to get parameters and such in my roller templates? Posted in The Web at Nov 18 2002, 02:11:06 PM MST 1 Comment
Search This Site
Recent Entries
- Happy Birthday Mom!
- 2008 - A Year in Review
- Portland Tech Meetup Tomorrow Night
- My "almost slept in a snow cave" Adventure with Clint Foster
- My Christmas Travel Adventure
- AppFuse Light converted to Maven modules, upgraded to Tapestry 5 and Stripes 1.5
- Dojo/Comet support in Java Web Frameworks
- Abbie is a Blue Skier!
- How I recovered data from my failed Linux box
- Costa Rica was Awesome!
Posted by Dave Johnson on November 18, 2002 at 03:10 PM MST #