I have no useful thing to say about your particular problem with this s:component tag, but if you are rendering JSP pages, then you may well find it more compelling to create a custom tag file, hence avoiding the Freemarker scripts.
2009/12/23 Vitor E. Silva Souza <vitorso...@gmail.com>: > 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> </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 > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org