OGNL Maps in WebWork using JSP 2.1

Jetty 6 (which I use for day to day development) automatically uses JSP 2.1 if you are on JDK 5.0 or above, regardless of what you have specified in web.xml.

This had been biting me on WebWork, because of the introduction of unified EL. The following is no longer valid:

<ww:select list=”#{‘default’ : ‘Maven 2.x Repository’, ‘legacy’ : ‘Maven 1.x Repository’}” />

But, to escape it with \#{ doesn’t work on Tomcat 5 and other 2.0 containers.

The solution?

<ww:select list=”#@java.util.HashMap@{‘default’ : ‘Maven 2.x Repository’, ‘legacy’ : ‘Maven 1.x Repository’}” />

Thank goodness OGNL had this other syntax for maps that doesn’t look like an expression 🙂

Technorati Tags:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s