Matt RaibleMatt Raible is a Web Developer and Java Champion. Connect with him on LinkedIn.

The Angular Mini-Book The Angular Mini-Book is a guide to getting started with Angular. You'll learn how to develop a bare-bones application, test it, and deploy it. Then you'll move on to adding Bootstrap, Angular Material, continuous integration, and authentication.

Spring Boot is a popular framework for building REST APIs. You'll learn how to integrate Angular with Spring Boot and use security best practices like HTTPS and a content security policy.

For book updates, follow @angular_book on Twitter.

The JHipster Mini-Book The JHipster Mini-Book is a guide to getting started with hip technologies today: Angular, Bootstrap, and Spring Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.

This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.

For book updates, follow @jhipster-book on Twitter.

10+ YEARS


Over 10 years ago, I wrote my first blog post. Since then, I've authored books, had kids, traveled the world, found Trish and blogged about it all.

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
Comments:

The reason that Velocity choked on $cookie is that Velocity only exposes the objects that you tell it to expose. In the Roller page templates, the only object that we expose is the $macros object.

Posted by Dave Johnson on November 18, 2002 at 10:10 PM MST #

Post a Comment:
  • HTML Syntax: Allowed