commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kyle Braak (JIRA)" <>
Subject [jira] [Created] (OGNL-221) Map with String key that contains a non-word character prevents value from being saved
Date Wed, 15 Aug 2012 14:46:38 GMT
Kyle Braak created OGNL-221:

             Summary: Map with String key that contains a non-word character prevents value
from being saved
                 Key: OGNL-221
             Project: Commons OGNL
          Issue Type: Bug
         Environment: struts2 version 2.2.1 - which uses OGNL 3.0
freemarker version 2.3.19
            Reporter: Kyle Braak

I have written a very simple Action, and freemaker template so that you can replicate my problem.

My Action is as follows: 

public class TestAction extends BaseAction {
  private Map<String, String> tmap = new TreeMap<String, String>();

  public void prepare() throws Exception {
    tmap.put("Animalia", "");
    tmap.put("Ani_malia", "");
    tmap.put("Ani:malia", "");
    tmap.put("Ani-malia", "");
    tmap.put("Ani%malia", "");
    tmap.put("Ani+malia", "");

  public String execute() {
    return SUCCESS;

  public Map<String, String> getTmap() {
    return tmap;

It prepares a TreeMap with some entries having only a String key, and an empty String value.

The following freemarker template displays the keys, and allows the user to save a new value
for each one:

<form action="" method="post">
  <#list tmap?keys as k>
    <td><input type="text" name="tmap['${k}']" value="${tmap.get(k)!}"/></td>
  <@s.submit name="save"/>

Unfortunately, after entering new values for each key and submitting the form, the only keys
that have values successfully saved are: 


The following keys do NOT have values successfully saved:


Indeed the presence of such non-word characters breaks the OGNL parsing of the Map's String

To be sure no unwanted interception is occurring, I am using the most basic struts.xml configuration:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"

  <package name="ipt-default" extends="struts-default" namespace="/">

      <result-type name="freemarker" class="org.apache.struts2.views.freemarker.FreemarkerResult"

    <action name="test" class="org.gbif.ipt.action.portal.TestAction">


Thank you very much for any help you can offer.

With kind regards

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message