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
- Secure JSON Services with Play Scala and SecureSocial
- My What's New in Spring 3.1 Presentation
- Twitter's Open Source Summit: Bootstrap 2.0 Edition
- Refreshing AppFuse's UI with Twitter Bootstrap
- 2011 - A Year in Review
- Upgrading AppFuse to Spring Security 3.1 and Spring 3.1
- What have I been working on at Taleo?
- Our Engaging Trip to Paris and Antwerp
- My HTML5 with Play Scala, CoffeeScript and Jade Presentation from Devoxx 2011
- Deploying Java and Play Framework Apps to the Cloud with James Ward
Posted by Dave Johnson on November 18, 2002 at 04:10 PM MST #