2009-10-26

JSTL on Google App Engine

This caught me out this morning. I was trying to get a simple JSP page with EL to work in Google App Engine but the EL wasn't being evaluated. This was what I had:

<%@ page contentType="text/html" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE html>
<html>
 <head>
  <title>Maintenance</title>
 </head>
<body>
 <p>Hello from Spring ${user}</p>
 <p>AuthDomain = ${user.authDomain}</p>
 <p>Nickname = ${user.nickname}</p>
 <p>Email = ${user.email}</p>
 <p>UserId = ${user.userId}</p>
</body>
</html>

Unfortunately the output from this was:

Hello from Spring ${user}
AuthDomain = ${user.authDomain}
Nickname = ${user.nickname}
Email = ${user.email}
UserId = ${user.userId}

In order to get Google App Engine to evaluate the EL I had to add this:

<%@ page isELIgnored="false" %>

to the top of the JSP.

3 comments:

Unknown said...

Thank you, this was just what I needed!

Anonymous said...

this article helps me. thanks.

Trurle said...

I am trying to use JSTL with Google app engine application; while common JSTL statements like
<c:set var="name" value="world" />
name = <c:out value="${name}"/>
and
Request method = <c:out value="${pageContext.request.method}"/>
appear to work, I am not able to access user with EL like
User id = <c:out value="${user.nickname}"/ >

What am I doing wrong?