JSP Expression Language in GWT’s embedded Jetty

JSP expression language (EL) is quite handy. but it only works when you indicate your web application is using version 2.4 or higher. That means you have the following in your <Your-Web-App>/WEB-INF/web.xml:

<?xml version=”1.0″ encoding=”UTF-8″?>
<web-app id=”WebApp_ID” version=”2.4″ xmlns=”http://java.sun.com/xml/ns/j2ee” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd”>

Google Web Toolkit (GWT) is a handy Ajax Web application development tool. Since version 1.6.4, GWT uses Jetty instead of Tomcat as the embedded Web application container.

However, when I installed GWT plugin (version 1.6.4) for Eclipse, the default generated web application used the version 2.3. So when i used expression language in the jsp pages, it didn’t evaluate. Something like “${title}” as the output in the hosted mode running on jetty. It should also be the same result even i deployed to a tomcat container, as the web app version is still 2.3. This is understandable, as Expression Language is part of JSP version 2.0 standard, which is bound with Servlet (Web App) version 2.4. So if you want to make the expression language work, make sure your web app is using 2.4 or higher.

However, while using version 2.4 works fine, i’ve got the same problem when i use version 2.5, which is hard to understand why. This problem seems only in Jetty, not in Tomcat. I don’t know if anyone else have encountered the same problem as I did, but the following link seems to explain the reason behind: http://docs.codehaus.org/display/JETTY/JSP+expression+do+not+evaluate

Apart from this problem (which can be worked around), the use of GWT plugin seems more convenient than the traditional web app development in eclipse. :)

Leave a Reply

Spam Protection by WP-SpamFree