Question: I am new to JSF2 and having very less idea about front end developement.Currently i am trying to iterate over a list in a text area using JSF2? we have a list of datas like **aList[bean1,bean2,bean3,....]** and we have to print datas 

```
<h:inputTextarea var ="list" value="#{Bean.value}">
row1-> datas of bean1
row2-> datas of bean2
like all the datas in the list 
</h:inputTextarea>

```

I vahe searched a lot but did not get proper information, please help me.

Answer: 
This should do what you want:

```
def connection(pairs, item):
    return ''.join([p[1-p.index(item)] for p in pairs if item in p])

```

Here's some sample output:

```
>>> connection([('a','b'),('c','d'),('e','f'),('c','a')], 'a')
'bc'

```
```
pairs = [('a','b'),('c','d'),('e','f'),('c','a')]

def connections(pairs, item):
    output = ''
    for j in pairs:
        if item in j:
            index = 1-j.index(item)
            output = output + str(j[index])
    return (output)

print(connections(pairs, 'c'))

```

Output:

```
da

```