• Post Reply Bookmark Topic Watch Topic
  • New Topic

jstl-c length of a string in c:if test  RSS feed

 
Joe Busch
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to test the length of a string field using the expression langauage?

The following line does not recognize the length() call:
c:if test="${displaybean.UserName.length() le 30}"

Thanks in advance.
Joe
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following line does not recognize the length() call


Right. You can't make function calls in the EL.

If you are using JSTL 1.1 there's a length function in the fn group to obtain the length of an element. For JSTL 1.0, you need to provide the length to the page as a separate scoped variable.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!