I am working on a project interface that gives me Language Expression Language tags to work with. In one case, I need to see if it returns an array or only one bit of data, and I donβt know how to work with it.
Example:
The page has
<p>${WebAppContext.buildings[0].location.name}</p>
which will output something like:
<p>Acme</p>
The problem is that I need to output more if there are more buildings in the bits:
Something like (in pseudocode):
if isArray(${WebAppContext.buildings}){
foreach(${WebAppContext.buildings} as foo){
}
}
so I can output something like:
<p>${WebAppContext.buildings[0].location.name}</p>
<p>${WebAppContext.buildings[1].location.name}</p>
I asked the Java people responsible for creating this code, and they said, "Dunnokindofbusyrightnowbuhbye." so I hope you have some understanding.
, , Java Expression Language ( , , ). / .
EDIT:
:
<c:forEach var='building' items='${WebAppContext.buildings}'>
<p>${building.location.name}</p>
</c:forEach>
:
<c:forEach var='meeting' items='[Lorg.foo.bar.baz.bat.serviceapi.webserviceobject.xsd.BuildingsWSO;@3823ff8'>
<p></p>
</c:forEach>
, , Java Expression Language, , items = '' , , , .
, :
<p>${WebAppContext.buildings[0].location.name}</p>
<p>${WebAppContext.buildings[1].location.name}</p>
:
<p>Krustylu Studios</p>
<p>Springfield Nuclear Power Plant</p>