得到了一个解决方案,也许它可以帮助别人有时......不管怎么说,这里是我的解决方案:
<!-- Has more then 3 elements - display hotspots in two columns -->
<h:outputLabel rendered="#{SomeClass.hasMoreThanThree}" >
Render the site elements for this case
</h:outputLabel>
<!-- Has less then or 3 elements - display hotspots in one column -->
<h:outputLabel rendered="#{not SomeClass.hasMoreThanThree}" >
Render the site elements for this case
</h:outputLabel>
在控制器:
public class SomeClass implements Serializable {
private boolean hasMoreThanThree;
public SomeMethod(SomeType someParameter) {
...some code...
setHasMoreThanThree(someList.size());
...some more code..
}
public boolean getHasMoreThanThree() {
return hasMoreThanThree;
}
public void setHasMoreThanThree(int size) {
if (size >= 3){
this.hasMoreThanThree=true;
}
}
这是类似的,但不是我问..已经检查了 –
见http://stackoverflow.com/questions/7145574/using-greater-than-logical-expression-in-rendered-attribute –
也许试试呈现标记 –