Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You don't have to do the work in the jsp. You could do that work in a model object and the controller.</p> <pre><code>public class CountryFinancialEntity { private Country country; public CountryFinancialEntity(Country country) { this.country = country; } public String getCountryName() { return this.country.getName(); } public List&lt;String&gt; getFinancialEntityNames() { List&lt;String&gt; financialEntityNames = new ArrayList&lt;String&gt; for (Account account : this.country.getAccounts() { financialEntityNames.add(account.getFinancialEntity().getName(); } } } </code></pre> <p>Then make a list of these objects for all your countries and pass this object to your view (jsp).</p> <p>Hopefully this will simplify the use of the display tags and allow you to use a c:forEach tag.</p> <p><strong>EDIT</strong></p> <p>If you MUST do this work in the jsp.</p> <p>I would recommend just passing the list of countries. The MyActionBean really doesn't help and could cause confusion.</p> <p>Your jsp will look something like the following:</p> <pre><code>&lt;display:table id="country" name="countries"&gt; &lt;display:column title="Country Name" property="name" /&gt; &lt;display:column title="Financial Name" &gt; &lt;ul&gt; &lt;c:forEach var="account" items="${country.accounts}"&gt; &lt;li&gt;${account.financialEntity.name}&lt;/&gt; &lt;c:forEach&gt; &lt;/ul&gt; &lt;/display:column&gt; &lt;/display:table&gt; </code></pre> <p>BTW, this is most likely how the CountryFinancialEntity would look as well come to think of it, but if you're going to have other columns then using something like the CountryFinancialEntity object, but calling it a TableRowModel instead.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload