If you're worried about hitting a non-existent array member, do this:

${(seq[n].myFieldOfInterest)!"Not Found!"}

Note that braces ().

Jonathon

Chris Howe wrote:
I just confirmed it, it does.

To test, I edited party/webapp/partymgr/party/findparty.ftl

line 87 has the following:
<#list roleTypes as roleType>
  <option
value="${roleType.roleTypeId}">${roleType.get("description",locale)}</option>
</#list>

after the subsequent td endtag, I added...
<td>${roleTypes[0].get("description",locale)}</td>
and was givin the correct description in a third column on the main
page of the party application.(localhost/partymgr/conrol/main)

So in your example, ${seq[0]} will print the first hashmap of the
collection seq.  If you wanted to access a specific field of the
hashmap, you would use ${seq[0].myFieldOfInterest?if_exists}
--- nashrul <[EMAIL PROTECTED]> wrote:

thanks for your advice ghove.. but i try to apply this, and it
doesn't work
....


cjhowe wrote:
hmm..IIRC correctly, try ${seq[0]}  x is the current object in the
index.
--- nashrul <[EMAIL PROTECTED]> wrote:

I have this ftl snippet code.

<#assign seq = ["winter", "spring", "summer", "autumn"]>
<#list seq as x>
     --htmll code here
     --retrieviing seq here from certain index
</#list>
How can i retrieve just the certain index from seq list (say x[0]
and
x[1])
??
--
View this message in context:

http://www.nabble.com/retrieving-list-in-ftl-from-specified-index-tf4323738.html#a12312945
Sent from the OFBiz - User mailing list archive at Nabble.com.




--
View this message in context:

http://www.nabble.com/retrieving-list-in-ftl-from-specified-index-tf4323738.html#a12323519
Sent from the OFBiz - User mailing list archive at Nabble.com.





Reply via email to