tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Martin" <john.martin...@virgin.net>
Subject Map backed ActionForm, and jstl expression language
Date Fri, 02 Jul 2004 00:00:15 GMT
Hi all,

Any help on the following problem would be most appreciated.

What i am trying to do is produce a report of data in tabular form with filters that will
reduce the report set. There can be 100's of different reports but by passing in a report
id to a database the query, filters, columns and row values can be determined.

So i use a map backed action form for the filter property and there values, this contains
the methods

  public void setValue(String key, Object value) {
        values.put(key, value);
    }

    public Object getValue(String key) {
        return values.get(key);
    }

For example, i want the first filter to have a value of 1, so i setValue("filter1","1") and
the second filter to be value 2 (setValue("filter1","1")).

Now i populate another bean with the filter labels and values, that gets stored in the request.
These are filter lists are stored as array lists in a hashmap with the the key, being the
filter property, in this case "filter1" and "filter2". 

So in the jsp i write
      <c:forEach items="${dao.hmOfLists}" var="list">
       <c:set var="props" value="${list.key}"/>
       <c:set var="values" value="${list.value}"/>
      <html-el:select property="${props}" value="">
        <html:options collection="values" property="value" labelProperty="label"/>
      </html-el:select>
      </c:forEach>

this gets me the all the filters that have been stored in the hashmap from the object "dao"
via the property hmOfLists, with the key in the hashmap being the filter property. However,
i want to set the defaults on the filters via the map backed action form, but if i write <html-el:select
property="${props}" >, i get an error of "No getter method available for property filter2......etc".
So i try an access the value, in the html-el:select using the expression value="${testForm.props}",
but this shouldn't (and doesn't work) as label is actually the variable props from the hashmap,
not the property props from the testForm. How i can i make it use the var props instead of
the string literal, in order to determine the property to retrieve from the map based action
form ?

Thanks,

John






Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message