aspose file tools*
The moose likes JSP and the fly likes c:if  syntax error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "c:if  syntax error" Watch "c:if  syntax error" New topic
Author

c:if syntax error

Raj Ohadi
Ranch Hand

Joined: Jun 30, 2006
Posts: 316
I have a session object "CART" that is a List, In my JSP I have

<c:if test="${!empty sessionScope.CART and sessionScope.CART.size() > 0}">
// proess things
</c:if>

But it complains the syntax error. I don't know why ?? All I want to do is to check if the CART is not null and has more than one element..

Thanks.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61209
    
  66

You cannot call instance methods in the EL. In other words, no calls to size().


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61209
    
  66

By the way, you don't need to do the size check anyways. The empty operator will return true if the operand is null or if it is empty.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: c:if syntax error