Hello all,

I'm creating a UI Component with Struts 2.1.8.1. The FreeMarker variable 
parameters seems to be made available as String and not as Hash as I expected 
(and according to [1]).

[1] = http://www.vitarara.org/cms/struts_2_cookbook/creating_a_ui_component

In the web page, I have something like this:

  <s:component template="book-list.ftl" >
    <s:param name="deletecolumn" value="true" />
  </s:component>  

And in the file template/xhtml/book-list.ftl (in the source folder) I have a 
component that shows a table with the list of books in the database:

  <#if books?size == 0>
    <p><@s.text name="noBooks" /></p>
  <#else>
    <table align="center" size="90%">
    <tr>
      <th><@s.text name="name" /></th>
      <th><@s.text name="authors" /></th>

      <#if parameters?contains("deletecolumn=true")>
        <th>&nbsp;</th>
      </#if>
    </tr>
    <#list books as book>
      <tr>
        <td>${book.name}</td>
        <td>${book.authors}</td>
        
        <#if parameters?contains("deletecolumn=true")>
          <td>[... delete button ...]</td>
        </#if>
                 
      </tr>
    </#list>
    </table>  
  </#if>


I expected to have to use it like this, as a hash (or something like it):

<#if parameters.deletecolumn == "true">

And instead, the only way it works is as above, as a string:

<#if parameters?contains("deletecolumn=true")>

If I use it as hash, it gives me ArrayIndexOutOfBoundsException: -1.

Any thoughts?

Thanks in advance,

Vitor Souza


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to